-
Notifications
You must be signed in to change notification settings - Fork 13
Feat/abstract configs #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportBase: 86.15% // Head: 84.61% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #38 +/- ##
==========================================
- Coverage 86.15% 84.61% -1.55%
==========================================
Files 13 15 +2
Lines 1127 1183 +56
==========================================
+ Hits 971 1001 +30
- Misses 156 182 +26
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@dpguthrie There's a lot in this PR, so to help organize thoughts I wanted to lay out a few areas where feedback would be valuable:
|
I came up with a different approach for validation using the pydantic library. This would both do validation of the payload that a user specifies as well as give it the appropriate defaults ( We can iterate on what's best, I just didn't want to overwrite all your work. |
Putting this here as well - my take is that we should be building out different methods that accomplish these different tasks. The |
@dpguthrie 100 on breaking out separate methods that all get to the base trigger_job. I was mid-way on that before thinking to stop and ask you :)) |
dbtc/client/cloud/base.py
Outdated
|
||
return 'api_key' | ||
|
||
def _clone_resource(self, resource: str, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dpguthrie this is very cool! Is there a means I could use to subset which fields from the base object are used for replication? It seems like this is the intent of create_args
, but I think a field subset being passed there would need to affect the payload
in order for that modification to occur.
Context: When trying to replicate a job, I'm not able to use fields such as deferring_job_definition_id
on the CREATE JOB endpoint. The process needs to first create the job with fewer fields, and then add the deferring_job_defintion_id
in an update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, we need another argument here for that. Good call! Who knows this private method may be a bit overkill for the things we need to do as well as thinking about what resources actually need to be cloned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per conversation offline, noting that we agreed this isn't something to pursue further for now. There will be too much situational variation in what's needed to replicate resources, so we should stick to the CRUD operations and adjust as-needed for other use cases.
dbtc/client/cloud/base.py
Outdated
new_job_definition = {k:v for k,v in existing_job_defintion.items() if k in required_fields} | ||
|
||
if not autoscale_job_identifier: | ||
creation_time = datetime.now().strftime('%Y-%m-%d-%H-%M-%S') | ||
new_job_name = '-'.join([new_job_definition['name'], creation_time]) | ||
new_job_definition['name'] = new_job_name | ||
else: | ||
new_job_name = '-'.join([new_job_definition['name'], autoscale_job_identifier]) | ||
new_job_definition['name'] = new_job_name | ||
|
||
# make sure the id is none on the new job | ||
new_job_definition['id'] = None | ||
job_id = self.create_job( | ||
account_id=account_id, payload=new_job_definition | ||
)['data']['id'] | ||
|
||
# fill in optional fields on the job if present in the source | ||
for field in optional_fields: | ||
new_job_definition[field] = existing_job_defintion.get(field) | ||
|
||
# set the ID in the update request | ||
new_job_definition['id'] = job_id | ||
self.console.log(new_job_definition) | ||
job_id = self.update_job( | ||
account_id=account_id, job_id=job_id, payload=new_job_definition | ||
)['data']['id'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matt-winkler I'm not sure I follow here. Why wouldn't we just create the new job from the existing job definition (outside of setting id
to None
and changing the name
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dpguthrie we can't copy the existing data in the job 1:1 in a new CREATE JOB request. For example, you can't create a new job including the is_deferrable
parameter. That parameter needs to be applied in a subsequent UPDATE step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dpguthrie updated my comment with a better example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
@dpguthrie Think I found a happier medium with the cloning idea. This updates _clone_resource so that it will return a payload that includes the object's required fields + and optional fields that are not |
Also adding a comment that tests on autoscaling jobs are failing because we need to standardize on an account / jobs to work from. |
No description provided.