-
-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: versioned JobManager for reading/writing jobs across protocol versions #9434
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
Open
koenvanderveen
wants to merge
34
commits into
dev
Choose a base branch
from
koen/job-reader-writer
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
f39d888
Add versioned JobManager for reading/writing jobs across protocol ver…
koenvanderveen 1066487
Nest ProtocolSchema inside PackageProtocolSchema and drop BaseVersion…
koenvanderveen 7599a40
Replace PackageProtocolSchema with PackageInfo referenced by ReleaseA…
koenvanderveen abc9613
Add protocol_version to PackageInfo
koenvanderveen 3963071
Rename registry history dicts to package_version_history and protocol…
koenvanderveen 502d6f5
Key package_version_history by protocol version with PackageInfo valu…
koenvanderveen 74bd7b1
Remove schema_for_package_version
koenvanderveen 5b19f35
Simplify register_historic_protocol_schema to take only a ProtocolSchema
koenvanderveen 0fe5512
Make historic schema validation opt-in via raise_for_unknown_objects
koenvanderveen 16bde93
Split test_migration.py into focused test files
koenvanderveen 08cb97e
Rename test_schemas.py to test_protocol_schemas.py
koenvanderveen 8a75e4e
Regroup migration tests across files
koenvanderveen 5050046
Move history tests into test_release_artifacts.py and drop test_proto…
koenvanderveen 7fb2920
Rename history-stored test to old-protocols-stored
koenvanderveen 26f7875
Make protocol_version_for_peer raise on unknown peers by default; ren…
koenvanderveen 34f144d
Rename _write_downgraded to _write_in_target_version
koenvanderveen ad954d6
Add path docstrings to JobManager scanning helpers
koenvanderveen 5408c93
Rename _resolve_ref to _find_jobref_from_name
koenvanderveen 7870ec5
Remove _get_job_submitter; use the JobRef's ds_email directly
koenvanderveen 8b65c73
Reorganize syft-job migration tests into unit/ and p2p/ folders
koenvanderveen 93925b5
Add has_migration_path and test downgrade paths between all registere…
koenvanderveen 0d62c6c
Use MyVersionedObject instead of Job in syft-migration test mocks
koenvanderveen 6f0f177
Freeze released object schemas in release artifacts and detect drift
koenvanderveen 7bfb744
Apply prettier formatting to protocol-0.json
koenvanderveen 9e2b7f2
Split migrations history into package-artifacts and protocols folders
koenvanderveen 8d6388e
Explain the fix steps when released object schemas drift
koenvanderveen 995bf8f
Add generic loading test for all released protocol files
koenvanderveen d7dfb94
Move current-protocol roundtrip test into its own p2p test file
koenvanderveen 2484538
Group protocol sanity-check tests into their own p2p file
koenvanderveen c503a7f
test: verify job read/write against all released syft-job fixtures
koenvanderveen f82861e
refactor: derive JobInfo identity from the path-derived JobRef
koenvanderveen ab9289e
test: clarify protocol-compat test names and peer-layout assertions
koenvanderveen 46fea78
Merge branch 'dev' into koen/job-reader-writer
koenvanderveen 84c40ca
test: fix JobInfo construction in datasets_jobs_repr after identity r…
koenvanderveen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # syft-job | ||
|
|
||
| Job submission and execution for SyftBox: data scientists submit bash/Python jobs | ||
| into a data owner's inbox, the data owner reviews, approves, and runs them. | ||
|
|
||
| ## Releasing | ||
|
|
||
| On **every** release (after bumping the version), run both release scripts: | ||
|
|
||
| ```bash | ||
| uv run python scripts/export_release_artifact.py | ||
| uv run python scripts/generate_release_fixture.py | ||
| ``` | ||
|
|
||
| `export_release_artifact.py` always writes | ||
| `src/syft_job/migrations/history/package-artifacts/syft-job-<version>.json` | ||
| (the package's identity + the protocol it speaks), and additionally writes | ||
| `history/protocols/protocol-<n>.json` when the release ships a new protocol | ||
| version. It refuses to run if the job protocol changed without bumping | ||
| `JOB_PROTOCOL_VERSION` (`src/syft_job/migrations/registry.py`). | ||
|
|
||
| `generate_release_fixture.py` writes a full SyftBox tree — | ||
| `tests/migrations/p2p/fixtures/syft_job-<version>-protocol<p>_syftbox/` — exactly | ||
| as this release serializes jobs to disk. Commit it: future releases loop over | ||
| these fixtures (`test_older_protocol_compatibility.py`) to prove they can still | ||
| read and round-trip older on-disk data. | ||
|
|
||
| Tests check the code against these artifacts: released object versions are | ||
| frozen forever — changing one requires a new version plus migrations. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| """Export the release artifacts for the current syft-job version. | ||
|
|
||
| Run on EVERY release (uv run python scripts/export_release_artifact.py): | ||
| always writes the package release info; additionally writes the protocol | ||
| artifact when this release introduces a new protocol version. | ||
| """ | ||
|
|
||
| import sys | ||
|
|
||
| from syft_job.migrations.history import PACKAGE_ARTIFACTS_DIR, PROTOCOLS_DIR | ||
| from syft_job.migrations.registry import JOB_PROTOCOL_VERSION, job_registry | ||
| from syft_job.version import __version__ | ||
|
|
||
|
|
||
| def main() -> None: | ||
| # Import the models so every versioned object is registered. | ||
| import syft_job # noqa: F401 | ||
|
|
||
| if job_registry.protocol_changed_without_bump(): | ||
| sys.exit( | ||
| "The job protocol changed compared to the released " | ||
| f"protocol-{JOB_PROTOCOL_VERSION}.json; bump JOB_PROTOCOL_VERSION " | ||
| "in syft_job/migrations/registry.py before releasing." | ||
| ) | ||
|
|
||
| info_path = PACKAGE_ARTIFACTS_DIR / f"syft-job-{__version__}.json" | ||
| job_registry.compute_released_package_protocol_info().save(info_path) | ||
| print(f"Wrote {info_path}") | ||
|
|
||
| protocol_path = PROTOCOLS_DIR / f"protocol-{JOB_PROTOCOL_VERSION}.json" | ||
| if not protocol_path.exists(): | ||
| job_registry.compute_released_protocol().save(protocol_path) | ||
| print(f"Wrote {protocol_path} (new protocol version)") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
metadata.namewas replaced withref.job_namein most places, but still remains in others like here.