superset-showtime 0.5.1__py3-none-any.whl → 0.5.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of superset-showtime might be problematic. Click here for more details.

showtime/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
  Circus tent emoji state tracking for Apache Superset ephemeral environments.
5
5
  """
6
6
 
7
- __version__ = "0.5.1"
7
+ __version__ = "0.5.4"
8
8
  __author__ = "Maxime Beauchemin"
9
9
  __email__ = "maximebeauchemin@gmail.com"
10
10
 
@@ -246,6 +246,9 @@ class PullRequest:
246
246
  print(f"✅ Deployment completed - environment running at {show.ip}:8080")
247
247
  self._update_show_labels(show, dry_run_github)
248
248
 
249
+ # Blue-green cleanup: stop all other environments for this PR
250
+ cleaned_count = self.stop_previous_environments(show.sha, dry_run_github, dry_run_aws)
251
+
249
252
  # Show AWS console URLs for monitoring
250
253
  self._show_service_urls(show)
251
254
 
@@ -278,6 +281,9 @@ class PullRequest:
278
281
  print(f"✅ Rolling update completed - new environment at {new_show.ip}:8080")
279
282
  self._update_show_labels(new_show, dry_run_github)
280
283
 
284
+ # Blue-green cleanup: stop all other environments for this PR
285
+ cleaned_count = self.stop_previous_environments(new_show.sha, dry_run_github, dry_run_aws)
286
+
281
287
  # Show AWS console URLs for monitoring
282
288
  self._show_service_urls(new_show)
283
289
 
@@ -389,6 +395,9 @@ class PullRequest:
389
395
 
390
396
  def _determine_action(self, target_sha: str) -> str:
391
397
  """Determine what sync action is needed based on target SHA state"""
398
+ # CRITICAL: Get fresh labels before any decisions
399
+ self.refresh_labels()
400
+
392
401
  target_sha_short = target_sha[:7] # Ensure we're working with short SHA
393
402
 
394
403
  # Get the specific show for the target SHA
@@ -429,20 +438,20 @@ class PullRequest:
429
438
 
430
439
  def _atomic_claim(self, target_sha: str, action: str, dry_run: bool = False) -> bool:
431
440
  """Atomically claim this PR for the current job based on target SHA state"""
441
+ # CRITICAL: Get fresh labels before any decisions
442
+ self.refresh_labels()
443
+
432
444
  target_sha_short = target_sha[:7]
433
445
  target_show = self.get_show_by_sha(target_sha_short)
434
446
 
435
- # 1. Validate current state allows this action for target SHA
447
+ # 1. Validate current state allows this action for target SHA
436
448
  if action in ["create_environment", "rolling_update", "auto_sync"]:
437
449
  if target_show and target_show.status in [
438
450
  "building",
439
451
  "built",
440
- "deploying",
452
+ "deploying",
441
453
  ]:
442
- return False # Target SHA already in progress
443
-
444
- # Allow actions on failed, running, or non-existent target SHAs
445
- return True
454
+ return False # Target SHA already in progress - ONLY conflict case returns
446
455
 
447
456
  if dry_run:
448
457
  print(f"🎪 [DRY-RUN] Would atomically claim PR for {action}")
@@ -580,6 +589,17 @@ class PullRequest:
580
589
  for old_status_label in sha_status_labels:
581
590
  get_github().remove_label(self.pr_number, old_status_label)
582
591
 
592
+ # For running environments, ensure only ONE active pointer exists
593
+ if show.status == "running":
594
+ # Remove ALL existing active pointers (there should only be one)
595
+ existing_active_pointers = [
596
+ label for label in self.labels
597
+ if label.startswith("🎪 🎯 ")
598
+ ]
599
+ for old_pointer in existing_active_pointers:
600
+ print(f"🎯 Removing old active pointer: {old_pointer}")
601
+ get_github().remove_label(self.pr_number, old_pointer)
602
+
583
603
  # Now do normal differential updates - only for this SHA
584
604
  current_sha_labels = {
585
605
  label for label in self.labels
@@ -616,3 +636,51 @@ class PullRequest:
616
636
  print(f"📝 Logs: {urls['logs']}")
617
637
  print(f"📊 Service: {urls['service']}")
618
638
  print("")
639
+
640
+ def stop_previous_environments(self, keep_sha: str, dry_run_github: bool = False, dry_run_aws: bool = False) -> int:
641
+ """Stop all environments except the specified SHA (blue-green cleanup)
642
+
643
+ Args:
644
+ keep_sha: SHA of environment to keep running
645
+ dry_run_github: Skip GitHub label operations
646
+ dry_run_aws: Skip AWS operations
647
+
648
+ Returns:
649
+ Number of environments stopped
650
+ """
651
+ # CRITICAL: Refresh to get current shows including newly created one
652
+ self.refresh_labels()
653
+
654
+ stopped_count = 0
655
+
656
+ for show in self.shows:
657
+ if show.sha != keep_sha:
658
+ print(f"🧹 Cleaning up old environment: {show.sha} ({show.status})")
659
+ try:
660
+ show.stop(dry_run_github=dry_run_github, dry_run_aws=dry_run_aws)
661
+
662
+ # Remove labels for this old environment
663
+ if not dry_run_github:
664
+ old_labels = show.to_circus_labels()
665
+ print(f"🏷️ Removing labels for {show.sha}: {len(old_labels)} labels")
666
+ for label in old_labels:
667
+ try:
668
+ get_github().remove_label(self.pr_number, label)
669
+ except Exception as e:
670
+ print(f"⚠️ Failed to remove label {label}: {e}")
671
+
672
+ stopped_count += 1
673
+ print(f"✅ Stopped environment {show.sha}")
674
+
675
+ except Exception as e:
676
+ print(f"❌ Failed to stop environment {show.sha}: {e}")
677
+
678
+ if stopped_count > 0:
679
+ print(f"🧹 Blue-green cleanup: stopped {stopped_count} old environments")
680
+ # Refresh labels after cleanup
681
+ if not dry_run_github:
682
+ self.refresh_labels()
683
+ else:
684
+ print("ℹ️ No old environments to clean up")
685
+
686
+ return stopped_count
showtime/core/show.py CHANGED
@@ -165,17 +165,17 @@ class Show:
165
165
 
166
166
  # Detect if running in CI environment
167
167
  is_ci = bool(os.getenv("GITHUB_ACTIONS") or os.getenv("CI"))
168
-
168
+
169
169
  # Build command without final path
170
170
  cmd = [
171
171
  "docker",
172
- "buildx",
172
+ "buildx",
173
173
  "build",
174
174
  "--push",
175
175
  "--platform",
176
176
  "linux/amd64",
177
177
  "--target",
178
- "dev",
178
+ "showtime",
179
179
  "--build-arg",
180
180
  "INCLUDE_CHROMIUM=false",
181
181
  "--build-arg",
@@ -190,7 +190,7 @@ class Show:
190
190
  cmd.extend([
191
191
  "--cache-from",
192
192
  "type=registry,ref=apache/superset-cache:showtime",
193
- "--cache-to",
193
+ "--cache-to",
194
194
  "type=registry,mode=max,ref=apache/superset-cache:showtime",
195
195
  ])
196
196
  print("🐳 CI environment: Using full registry caching")
@@ -204,7 +204,7 @@ class Show:
204
204
 
205
205
  # Add --load only when explicitly requested for local testing
206
206
  force_load = os.getenv("DOCKER_LOAD", "false").lower() == "true"
207
-
207
+
208
208
  if force_load:
209
209
  cmd.append("--load")
210
210
  print("🐳 Will load image to local Docker daemon (DOCKER_LOAD=true)")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superset-showtime
3
- Version: 0.5.1
3
+ Version: 0.5.4
4
4
  Summary: 🎪 Apache Superset ephemeral environment management with circus tent emoji state tracking
5
5
  Project-URL: Homepage, https://github.com/apache/superset-showtime
6
6
  Project-URL: Documentation, https://superset-showtime.readthedocs.io/
@@ -1,4 +1,4 @@
1
- showtime/__init__.py,sha256=5ryBVT5km-Ec4J3VGcfmM-qk9YlhGYz1UuGdv8d9vZg,448
1
+ showtime/__init__.py,sha256=v4dfA5K-c1pUPNrB3iXwD3jjOyurED35BMm4yRTnJ24,448
2
2
  showtime/__main__.py,sha256=EVaDaTX69yIhCzChg99vqvFSCN4ELstEt7Mpb9FMZX8,109
3
3
  showtime/cli.py,sha256=cQB5kH-XWFX3MhsxRaChVdjVe_I_7kBVyFY4fQrHPWA,30542
4
4
  showtime/core/__init__.py,sha256=54hbdFNGrzuNMBdraezfjT8Zi6g221pKlJ9mREnKwCw,34
@@ -7,10 +7,10 @@ showtime/core/emojis.py,sha256=MHEDuPIdfNiop4zbNLuviz3eY05QiftYSHHCVbkfKhw,2129
7
7
  showtime/core/github.py,sha256=uETvKDO2Yhpqg3fxLtrKaCuZR3b-1LVmgnf5aLcqrAQ,9988
8
8
  showtime/core/github_messages.py,sha256=MfgwCukrEsWWesMsuL8saciDgP4nS-gijzu8DXr-Alg,7450
9
9
  showtime/core/label_colors.py,sha256=efhbFnz_3nqEnEqmgyF6_hZbxtCu_fmb68BIIUpSsnk,3895
10
- showtime/core/pull_request.py,sha256=PnDTvC57YDNxz2XwhZi0Zf5FHzeYqJyfdlCmlI85GNo,24071
11
- showtime/core/show.py,sha256=P2LCVtzG6P2HXR9_oYX3OZcDeQJpngee4sw-iv62vac,9714
10
+ showtime/core/pull_request.py,sha256=DMuNkoWZETg55CJuWsyv58UOpgkUWeT-XJbA_97OKjA,27229
11
+ showtime/core/show.py,sha256=FpxDm52LASCJvf8UF998AtNiVzfdYIwNEsPAsOAAwL0,9701
12
12
  showtime/data/ecs-task-definition.json,sha256=2acmqoF-3CxaBJP_VDkMMpG_U2RI4VPk1JvFOprMFyc,2098
13
- superset_showtime-0.5.1.dist-info/METADATA,sha256=JjLoKU2jo9fmxNwFW34JDRTwZMlTaqpDgcP38c9akms,12052
14
- superset_showtime-0.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- superset_showtime-0.5.1.dist-info/entry_points.txt,sha256=rDW7oZ57mqyBUS4N_3_R7bZNGVHB-104jwmY-hHC_ck,85
16
- superset_showtime-0.5.1.dist-info/RECORD,,
13
+ superset_showtime-0.5.4.dist-info/METADATA,sha256=vwZMCk_jL9X5_ZBPi8Gy-jYBZKhFkICinHC-eop0qsY,12052
14
+ superset_showtime-0.5.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ superset_showtime-0.5.4.dist-info/entry_points.txt,sha256=rDW7oZ57mqyBUS4N_3_R7bZNGVHB-104jwmY-hHC_ck,85
16
+ superset_showtime-0.5.4.dist-info/RECORD,,