Apply cutout function in async#75
Open
glaubervila wants to merge 4 commits into
Open
Conversation
Introduce perform_cutout(job_id, task_id), a single function that reads all execution parameters from the Task row in the database, discovers the input tiles, runs the real cutout engine and records the JobResult and status transitions in the correct order. - Add cutout/service/cutout_runner.py with file discovery and engine execution duplicated from the sync path (sync flow left untouched) - Add perform_cutout_task, a thin Celery wrapper used by the async chord; finalize_job remains the callback that completes the Job - Dispatch perform_cutout_task in ImageCutoutPolicy.dispatch_async, replacing the placeholder pipeline - Remove the now unused run_cutout_for_pos and fake_image_cutout - Add unit tests with mocked locator/engine (test_cutout_runner.py), update async API tests accordingly, and add a manual e2e battery (teste_cutout_runner.py) based on the exemplos.txt scenarios Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The sync endpoint now runs the same database flow as async — Job, Task and JobResult rows with ordered status transitions recorded by perform_cutout — executed inline in the request and returning the result file directly. Result files are now split by execution mode (/data/results/sync/ vs /data/results/async/) via the execution_mode parameter on JobService.create / create_tasks_for_job. With no remaining callers, the legacy pipeline was removed: - JobService.start / mark_executing and ImageCutoutPolicy.dispatch - Celery tasks image_cutout and des_cutout_circle - cutout/lib (DesCutout/BaseCutout) and the DesCutoutEngine "legacy" engine option; astrocut is now the only supported engine - legacy debug scripts (scripts/) and orphaned or stale test files - UWSPolicy abstract base now declares create_tasks_for_job and dispatch_async instead of the obsolete dispatch Add sync API tests (success, discovery error recorded in the DB, and multi-task rejection) and update the async/factory tests. Also cleans up planning notes and ad-hoc root test scripts, and gitignores the new sync results directory. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
des_cutout_functions.py, teste_funcoes.py and teste_classe.py carried the original Cutout2D/make_lupton_rgb prototype and ad-hoc experiments, none of them referenced anywhere. The astrocut engine pipeline supersedes them all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Three tests had drifted from the code they exercise:
- test_des_csv_locator: the locator builds file paths under
tiles_root/{tilename}/ since ef23765, not under the archive path
- test_cutout_parameters: engines defaults to ["astrocut"] when the
parameter is absent
- test_png_output: fits_cut is called with memory_only=True and
returns in-memory HDULists since ea8eafe; mocks now follow that
contract for both mono and RGB paths
Full suite is green: 53 passed, 0 failed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
No description provided.