Skip to content

Apply cutout function in async#75

Open
glaubervila wants to merge 4 commits into
mainfrom
apply_cutout_function_in_async
Open

Apply cutout function in async#75
glaubervila wants to merge 4 commits into
mainfrom
apply_cutout_function_in_async

Conversation

@glaubervila

Copy link
Copy Markdown
Contributor

No description provided.

glaubervila and others added 4 commits July 11, 2026 11:58
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant