Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Accept a task ID as part of the request and, if present, use it when …
Browse files Browse the repository at this point in the history
…creating the async task. If not present, create a task ID and use it (#168)
  • Loading branch information
jp-dbt authored Feb 16, 2023
1 parent fec173e commit c90ccb9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dbt_server/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class DbtCommandArgs(BaseModel):
# TODO: Need to handle this differently
profile: Optional[str]
callback_url: Optional[str]
task_id: Optional[str]


@app.exception_handler(InvalidConfigurationException)
Expand Down Expand Up @@ -203,7 +204,11 @@ async def dbt_entry_async(
# example body: {"state_id": "123", "command":["run", "--threads", 1]}
state = StateController.load_state(args)

task_id = str(uuid.uuid4())
if args.task_id:
task_id = args.task_id
else:
task_id = str(uuid.uuid4())

log_path = filesystem_service.get_log_path(task_id, state.state_id)

task = schemas.Task(
Expand Down

0 comments on commit c90ccb9

Please sign in to comment.