From d5ece9ac5663fc75a2bc7a46749e805460c339d5 Mon Sep 17 00:00:00 2001 From: Stuart Axelbrooke Date: Thu, 17 Jul 2025 23:30:45 -0700 Subject: [PATCH] Add env vars to make jobs take longer for visual interest --- examples/podcast_reviews/categorize_reviews_job.py | 2 ++ examples/podcast_reviews/daily_summary_job.py | 2 ++ examples/podcast_reviews/extract_podcasts_job.py | 2 ++ examples/podcast_reviews/extract_reviews_job.py | 2 ++ examples/podcast_reviews/phrase_modeling_job.py | 2 ++ examples/podcast_reviews/phrase_stats_job.py | 2 ++ 6 files changed, 12 insertions(+) diff --git a/examples/podcast_reviews/categorize_reviews_job.py b/examples/podcast_reviews/categorize_reviews_job.py index c74c88d..4cfc695 100644 --- a/examples/podcast_reviews/categorize_reviews_job.py +++ b/examples/podcast_reviews/categorize_reviews_job.py @@ -70,6 +70,8 @@ def handle_config(args): print(json.dumps(config)) def handle_exec(args): + import time, random, os; time.sleep(float(os.getenv('EXEC_SLEEP', '0')) * random.random()) + if len(args) < 2: print("Exec mode requires category and date arguments", file=sys.stderr) sys.exit(1) diff --git a/examples/podcast_reviews/daily_summary_job.py b/examples/podcast_reviews/daily_summary_job.py index 4f4a796..774d4fa 100644 --- a/examples/podcast_reviews/daily_summary_job.py +++ b/examples/podcast_reviews/daily_summary_job.py @@ -70,6 +70,8 @@ def handle_config(args): print(json.dumps(config)) def handle_exec(args): + import time, random, os; time.sleep(float(os.getenv('EXEC_SLEEP', '0')) * random.random()) + if len(args) < 2: print("Exec mode requires category and date arguments", file=sys.stderr) sys.exit(1) diff --git a/examples/podcast_reviews/extract_podcasts_job.py b/examples/podcast_reviews/extract_podcasts_job.py index bdd66bf..3d20563 100644 --- a/examples/podcast_reviews/extract_podcasts_job.py +++ b/examples/podcast_reviews/extract_podcasts_job.py @@ -65,6 +65,8 @@ def handle_config(args): print(json.dumps(config)) def handle_exec(args): + import time, random, os; time.sleep(float(os.getenv('EXEC_SLEEP', '0')) * random.random()) + # Write debug info to a file since stdout might not be captured debug_file = "/tmp/databuild_test/podcasts_debug.log" with open(debug_file, "w") as f: diff --git a/examples/podcast_reviews/extract_reviews_job.py b/examples/podcast_reviews/extract_reviews_job.py index 245db78..b8d37a8 100644 --- a/examples/podcast_reviews/extract_reviews_job.py +++ b/examples/podcast_reviews/extract_reviews_job.py @@ -77,6 +77,8 @@ def handle_config(args): print(json.dumps(config)) def handle_exec(args): + import time, random, os; time.sleep(float(os.getenv('EXEC_SLEEP', '0')) * random.random()) + if len(args) < 1: print("Exec mode requires date argument", file=sys.stderr) sys.exit(1) diff --git a/examples/podcast_reviews/phrase_modeling_job.py b/examples/podcast_reviews/phrase_modeling_job.py index 7c528fc..ac95246 100644 --- a/examples/podcast_reviews/phrase_modeling_job.py +++ b/examples/podcast_reviews/phrase_modeling_job.py @@ -70,6 +70,8 @@ def handle_config(args): print(json.dumps(config)) def handle_exec(args): + import time, random, os; time.sleep(float(os.getenv('EXEC_SLEEP', '0')) * random.random()) + if len(args) < 2: print("Exec mode requires category and date arguments", file=sys.stderr) sys.exit(1) diff --git a/examples/podcast_reviews/phrase_stats_job.py b/examples/podcast_reviews/phrase_stats_job.py index 5fe4f64..a20f567 100644 --- a/examples/podcast_reviews/phrase_stats_job.py +++ b/examples/podcast_reviews/phrase_stats_job.py @@ -70,6 +70,8 @@ def handle_config(args): print(json.dumps(config)) def handle_exec(args): + import time, random, os; time.sleep(float(os.getenv('EXEC_SLEEP', '0')) * random.random()) + if len(args) < 2: print("Exec mode requires category and date arguments", file=sys.stderr) sys.exit(1)