Closed huzaifmalik786 closed 4 months ago
@huzaifmalik786 this doesn't work as expected since get_client
is an async
context manager.
Please take a look here https://docs.prefect.io/latest/guides/using-the-client/ for examples. Then you can update your PR. Thanks.
@Ishankoradia working on it,
@Ishankoradia Please check it now.
@Ishankoradia @fatchat Please let me know if anything seems wrong with the PR.
good morning @huzaifmalik786
the function works as expected. but the tests are failing
async def
instead of def
await cancel_flow_run
in each of themproxy.service.get_client
You will have to google AsyncMock
to set this up correctly
To run the test suite you will need a GCP service account JSON. It doesn't need to have any permissions, so just create a service account in your GCP console and download the JSON.
If the file is saved locally on your laptop as service.json
then run the test suite with
GOOGLE_APPLICATION_CREDENTIALS="service.json" pytest --asyncio-mode=auto
Good morning @fatchat . I'll make the required changes. Thank You!
Description
This PR closes #104 . A new function has been added which accepts the
flow_run_id
as a parameter and cancels it.Implementation Details
proxy/service.py
, a new functioncancel_flow_run
has been added which takesflow_run_id
as a parameter and change it's state toCancelled
.tests/test_service.py
:test_cancel_flow_run_type_error
has been added to check for anyflow_run_id
type error.test_cancel_flow_run_failure
had been added to handle any case of failure.test_cancel_flow_run_success
checks for successful execution of the function.Tasks Completed
proxy/service.py
calledcancel_flow_run(flow_run_id: str)
tests/test_service.py
which tests this new function