Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions airflow/.astro/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project:
name: airflow
1 change: 1 addition & 0 deletions airflow/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM astrocrpublic.azurecr.io/runtime:3.1-11
File renamed without changes.
17 changes: 17 additions & 0 deletions airflow/dags/my_dag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from airflow.sdk import dag, task
from pendulum import datetime

@dag(
schedule="@daily",
start_date=datetime(2026, 1, 31),
description="test dag",
tags=["first dag"],
max_consecutive_failed_dag_runs=3,
)
def my_dag():

@task
def _task_a():
print("hello")

_task_a()
Empty file added celery_logging_config.py
Empty file.
14 changes: 7 additions & 7 deletions worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


logger = get_task_logger(__name__)
todays_date = datetime.now().strftime("%m-%d-%Y")
todays_date = datetime.now().isoformat()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The todays_date variable is defined at the module level, meaning it's evaluated only once when the worker process starts. For a long-running process like a Celery worker, this timestamp will become stale and not reflect the actual time a task is executed. This will lead to incorrect got_data_in timestamps and incorrect fallback dates for other fields. To fix this, the timestamp should be generated inside the get_github_data task. This global variable should be removed, and datetime.now().isoformat() should be called directly where the current time is needed within the task.

S3_BUCKET_NAME = "github-etl-data-bucket"


Expand Down Expand Up @@ -129,12 +129,13 @@ def get_github_data(self, start_in_repo_num: int = 0, batch_size: int = 500, git
remaining_api_calls = github_instance.rate_limiting
remaining = remaining_api_calls[0]

if remaining == 2:
print(f"Reached batch size limit of {batch_size}")
if counter >= batch_size:
print(f"Reached batch size of {batch_size}")
break

# # start_in_repo_num = counter
# # github_instance = gh_two
if remaining < 100:
print(f"Rate limit approaching ({remaining}). Stopping worker.")
break

# # raise self.retry(countdown=3600)
# break
Expand Down Expand Up @@ -191,5 +192,4 @@ def build_repo_chord(total: int = 5000, batch_size: int = 500):
# for start in range(0, 5000, 500)
# ])

# return chord(jobs)()

# return chord(jobs)()
Loading