Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
no longer read the developer's real `~/.eozilla/config`, which could inject a
logged-in token into the request headers and fail the assertion that an
unauthenticated client sends none. (#167)
- Successful dismissal of jobs via a DELETE request to the `/jobs/{jobID}`
endpoint returns a `JobInfo` object whose `status` field is always set
to "dismissed" as per requirement `/req/dismiss/job-dismiss-success`
of the OGC API - Processes - Part 1: Core specification. (#174)

### Other changes

Expand Down
4 changes: 3 additions & 1 deletion wraptile/src/wraptile/services/airflow/airflow_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ async def dismiss_job(self, job_id: str, *args, **kwargs) -> JobInfo:
raise ServiceException(
e.status, e.reason, exception=e, is_job_problem=True
) from e
return self.dag_run_to_job_info(dag_run)
job_info: JobInfo = self.dag_run_to_job_info(dag_run)
job_info.status = JobStatus.dismissed
return job_info

async def get_job_results(self, job_id: str, *args, **kwargs) -> JobResults:
dag_id = self.get_dag_id_from_job_id(job_id)
Expand Down
1 change: 1 addition & 0 deletions wraptile/src/wraptile/services/local/local_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ async def dismiss_job(self, job_id: str, *args, **_kwargs) -> JobInfo:
del self.jobs[job_id]
self.job_results.pop(job_id, None)
self.job_uses_processes.pop(job_id, None)
job.job_info.status = JobStatus.dismissed
return job.job_info

async def get_job_results(self, job_id: str, *args, **_kwargs) -> JobResults:
Expand Down
23 changes: 19 additions & 4 deletions wraptile/tests/services/local/test_local_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,27 @@ async def test_dismiss_running_job_cancels_future(self):
job_info = await self.service.dismiss_job(
job_id=job_info.jobID, request=self.get_request()
)
self.assertIn(
job_info.status,
{JobStatus.accepted, JobStatus.running, JobStatus.dismissed},
)
self.assertEqual(job_info.status, JobStatus.dismissed)
self.assertTrue(self.service.jobs[job_info.jobID].cancelled)

async def test_dismiss_running_job_leaves_entry(self):
job_info = await self.service.execute_process(
process_id="sleep_a_while",
process_request=ProcessRequest(inputs={"duration": 0.5}),
request=self.get_request(),
)
job_info = await self.service.dismiss_job(
job_id=job_info.jobID, request=self.get_request()
)
queried_job = await self.service.get_job(
job_info.jobID, request=self.get_request()
)
self.assertIsInstance(queried_job, JobInfo)
self.assertEqual(job_info.status, JobStatus.dismissed)
self.assertEqual(queried_job.status, JobStatus.dismissed)
self.assertEqual("sleep_a_while", queried_job.processID)
self.assertEqual(job_info.jobID, queried_job.jobID)

async def test_dismiss_finished_job_removes_cached_state(self):
job_info = await self.service.execute_process(
process_id="primes_between",
Expand Down
Loading