Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6a8a156
draft version
matt-winkler Sep 15, 2022
42d2de9
Merge branch 'main' into feat/trigger-ci-job-in-parallel
matt-winkler Sep 22, 2022
680ffc0
demo-able version
matt-winkler Sep 22, 2022
15bf9e1
create configs directory
matt-winkler Sep 23, 2022
917b4b2
sketch configs idea
matt-winkler Sep 23, 2022
db38153
adds autoscaling mode and moves some configs out of base _CloudClient
matt-winkler Sep 27, 2022
1eb1683
create enums file
matt-winkler Sep 27, 2022
d083cc2
update enums
matt-winkler Sep 27, 2022
593e000
add autoscale name slug
matt-winkler Sep 27, 2022
191f199
rename mode --> job_run_strategy
matt-winkler Sep 27, 2022
59bbc9f
Add pydantic
dpguthrie Sep 27, 2022
ccea05c
Add support for cloning, resource validation
dpguthrie Sep 27, 2022
70880e1
fix merge conflicts
matt-winkler Sep 28, 2022
299f391
fix merge conflicts
matt-winkler Sep 28, 2022
acf0b8e
merge feat/model-validation changes
matt-winkler Sep 28, 2022
c718176
autoscaling works again
matt-winkler Sep 28, 2022
0ba0df1
add test for autoscaling
matt-winkler Sep 28, 2022
e22551d
Update job
dpguthrie Sep 29, 2022
767582d
Add option for multiple status in list_runs method
dpguthrie Sep 30, 2022
4922990
Add tests for new status functionality
dpguthrie Sep 30, 2022
0ce7118
update restart_job_from_failure to trigger_job_restart_from_failure i…
matt-winkler Oct 7, 2022
cfea827
Merge branch 'feat/abstract-configs' of github.com:dpguthrie/dbtc int…
matt-winkler Oct 7, 2022
ce98cde
update required fields for Job to include dbt_version
matt-winkler Oct 8, 2022
2a137a7
_clone_resource gives a base payload to be modified by use case
matt-winkler Oct 8, 2022
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: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: isort
stages: [commit,push]
name: isort
entry: poetry run isort -rc
entry: poetry run isort
language: system
types: [python]
- id: black
Expand Down
72 changes: 70 additions & 2 deletions dbtc/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# stdlib
from enum import auto
import json
from typing import List, Optional

Expand Down Expand Up @@ -255,11 +256,10 @@ def create_environment_variables(
def create_job(
ctx: typer.Context,
account_id: int = ACCOUNT_ID,
project_id: int = PROJECT_ID,
payload: str = PAYLOAD,
):
"""Create a job in a project."""
_dbt_cloud_request(ctx, 'create_job', account_id, project_id, json.loads(payload))
_dbt_cloud_request(ctx, 'create_job', account_id, json.loads(payload))


@app.command()
Expand Down Expand Up @@ -969,6 +969,74 @@ def test_connection(
)


@app.command()
def trigger_job_with_autoscaling(
ctx: typer.Context,
account_id: int = ACCOUNT_ID,
job_id: int = JOB_ID,
payload: str = PAYLOAD,
should_poll: bool = typer.Option(
True,
help='Poll until job completion (status is one of success, failure, or '
'cancelled)',
),
poll_interval: int = typer.Option(
10, '--poll-interval', help='Number of seconds to wait in between polling.'
),
autoscale_delete_post_run: bool = typer.Option(
False, help='Delete the cloned job immediately after it runs'
),
autoscale_job_identifier: str = typer.Option(
False,
help=(
'A string to append to the name of the job with id specified in job_id '
'E.g. if the job is named "my_dbt_cloud_job" and the autoscale_job_identifier '
'is "my_new_job", the cloned job will be named "my_dbt_cloud_job-my_new_job" '
),
),
):
"""Trigger job to run."""
_dbt_cloud_request(
ctx,
'trigger_job_with_autoscaling',
account_id,
job_id,
json.loads(payload),
should_poll=should_poll,
poll_interval=poll_interval,
autoscale_delete_post_run=autoscale_delete_post_run,
autoscale_job_identifier=autoscale_job_identifier,
)


@app.command()
def trigger_job_restart_from_failure(
ctx: typer.Context,
account_id: int = ACCOUNT_ID,
job_id: int = JOB_ID,
payload: str = PAYLOAD,
should_poll: bool = typer.Option(
True,
help='Poll until job completion (status is one of success, failure, or '
'cancelled)',
),
poll_interval: int = typer.Option(
10, '--poll-interval', help='Number of seconds to wait in between polling.'
)
):
"""Trigger job to rerun from the point of failure on its most recent run
Does nothing if no failures are identified on the most recent run."""
_dbt_cloud_request(
ctx,
'trigger_job_restart_from_failure',
account_id,
job_id,
json.loads(payload),
should_poll=should_poll,
poll_interval=poll_interval,
)


@app.command()
def trigger_job(
ctx: typer.Context,
Expand Down
Loading