Add preliminary job_runs resource#5603
Draft
radakam wants to merge 8 commits into
Draft
Conversation
Collaborator
Integration test reportCommit: 336177f
24 interesting tests: 15 SKIP, 7 KNOWN, 2 flaky
Top 24 slowest tests (at least 2 minutes):
|
63df005 to
ff9faea
Compare
Introduce the job_runs bundle resource backed by the Jobs RunNow API. This is a preliminary skeleton: it wires up the config type, the direct engine resource, registration, and drift handling. Generated schema, validation output, and tests are intentionally left for follow-ups.
Run the schema generator for the new job_runs resource and add real descriptions for the job_runs map, JobRun.lifecycle, and JobRun.python_named_params so the required-annotations guard test passes.
Regenerate the validation rules so job_runs picks up its required field (job_id) and the performance_target enum. Missing required fields surface as warnings via the existing validate:required mutator.
Deploy a bundle with a job and a job_run referencing it, and assert that exactly one RunNow request is made and the returned run id is stored in state. Restricted to the direct engine since job_runs has no Terraform equivalent.
Verify that changing a job_run's configuration re-triggers the run: after the initial deploy, a config change (job_parameters) causes a second, distinct RunNow request on redeploy via the recreate-on-change path.
Several reflection/enumeration tests iterate or hardcode the full resource set and were not updated when the job_runs resource was added, leaving CI red. Add job_runs to each: the run_as allResourceTypes list, the permissions unsupportedResources list, the target-mode mock bundle, the Terraform lifecycle skip list (direct-only), a bind fixture + GetRun mock, and a direct CRUD fixture that triggers a run against a newly created job. The CRUD test also treats job_runs as a no-op delete, since a triggered run cannot be undeployed and stays readable afterward.
a899c09 to
3fb23a7
Compare
Fully populate the GetRunRequest and JobRunRemote literals in job_run.go to satisfy exhaustruct, and regenerate the schema/refschema/apitypes artifacts so the committed job_runs generated files match their generators.
Add job_runs coverage to the two reflection-driven completeness tests: add "job_runs" to the noURL set in TestBundleResourcePluralNamesResolveInWorkspaceURLs (no stable workspace URL yet) and exercise Resources.JobRuns in the StateToBundle test suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Add a
job_runsbundle resource (direct engine). Deploying it triggers a job run via the JobsRunNowAPI and stores the run id in state.Includes the resource + direct CRUD, lifecycle config, generated schema/validation,
run_ashandling, acceptance tests, and updates to the resource-enumeration tests.Because a run isn't a normal CRUD resource, a few deliberate choices:
RunNow); the run id is the tracked identity.recreate_on_changes— changes re-trigger a fresh run.GetRunnever echoes theRunNowrequest, so request fields areignore_remote_changes(write-only inputs).RunNowhas norun_as, so a differing bundlerun_asis rejected early.Closes DECO-27355.
(Waiting for completion + run URL are deferred to a later milestone.)
Why
Today, triggering a job as part of
bundle deployrequires custom scripts outside the bundle. This project adds aresources.job_runssection to direct engine so users can declaratively run jobs as part of deployment — e.g. schema migrations, model training, data prep.Tests
job_runs/basic(one run-now, run id stored, clean destroy) andjob_runs/redeploy(recreate onjob_parameterschange).TestAll/job_runsdirect CRUD.run_as, permissions, target-mode, Terraform lifecycle, bind-support enumeration, workspace-URL completeness (job_runsadded tonoURL— no stable run URL yet), andStateToBundleenumeration tests.