use iri models in submit_job#4
Conversation
avoids getattr everywhere. jobspec is non-optional for adapter.submit_job(), so we don’t have to check if it is there or not.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f96387545e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return compute_models.Job( | ||
| id=str(resp.job_id), | ||
| # TODO: check if 200 always mean it is queued | ||
| status=compute_models.JobStatus(state=JobState.QUEUED), | ||
| ) |
There was a problem hiding this comment.
Keep submit_job return shape backward-compatible
Returning a compute_models.Job object here changes submit_job from a mapping-like result to a model instance, which breaks existing direct callers that still index into the result (for example app/s3df/slurm/test_slurmrestd.py uses result["id"] and result["status"]["state"]). In environments that invoke the adapter directly (outside FastAPI response serialization), this will raise at runtime and stop job-submission workflows.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@amithmslac this will break some tests, i guess
we avoid getattr everywhere. jobspec is non-optional, so we don’t have to check if it is there or not.
this is easier to read, and uses the same signature as the template in https://github.com/slaclab/iri-facility-api-python/blob/main/app/demo_adapter.py
going forward, would be best to aim to match this in other parts of the code