Hemabh Kamboj
03/06/2024, 10:09 AMtask = get()
10:06:48.919 | INFO | Task run 'Key Frame Extraction-0' - File "/usr/lib/python3.10/multiprocessing/queues.py", line 363, in get
def get(self):
10:06:48.919 | INFO | Task run 'Key Frame Extraction-0' - File "/home/azureuser/papt/prefect-env/lib/python3.10/site-packages/prefect/engine.py", line 2258, in cancel_flow_run
raise TerminationSignal(signal=signal.SIGTERM)
10:06:48.920 | INFO | Task run 'Key Frame Extraction-0' - prefect.exceptions.TerminationSignal
but this function is working if i do not make it as a prefect taskMarvin
03/06/2024, 10:09 AMI have prefect task, i am getting following error in the task running locally```Process ForkPoolWorker-1: 100648.914 | INFO | Task run 'Key Frame Extraction-0' - Traceback (most recent call last): 100648.916 | INFO | Task run 'Key Frame Extraction-0' - File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap self.run() 100648.918 | INFO | Task run 'Key Frame Extraction-0' - File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) 100648.918 | INFO | Task run 'Key Frame Extraction-0' - File "/usr/lib/python3.10/multiprocessing/pool.py", line 114, in worker task = get() 100648.919 | INFO | Task run 'Key Frame Extraction-0' - File "/usr/lib/python3.10/multiprocessing/queues.py", line 363, in get def get(self): 100648.919 | INFO | Task run 'Key Frame Extraction-0' - File "/home/azureuser/papt/prefect-env/lib/python3.10/site-packages/prefect
Hemabh Kamboj
03/06/2024, 10:10 AMtask = get()
10:06:48.919 | INFO | Task run 'Key Frame Extraction-0' - File "/usr/lib/python3.10/multiprocessing/queues.py", line 363, in get
def get(self):
10:06:48.919 | INFO | Task run 'Key Frame Extraction-0' - File "/home/azureuser/papt/prefect-env/lib/python3.10/site-packages/prefect/engine.py", line 2258, in cancel_flow_run
raise TerminationSignal(signal=signal.SIGTERM)
10:06:48.920 | INFO | Task run 'Key Frame Extraction-0' - prefect.exceptions.TerminationSignal
but this function is working if i do not make it as a prefect taskMarvin
03/06/2024, 10:10 AMTerminationSignal
, which could be due to different kinds of interference or a flow run being intentionally cancelled. There are cases where hooks like on_cancellation
or on_crashed
may not execute correctly, especially when using KubernetesWorker
as detailed in this issue.
Furthermore, there could be an issue with context, particularly when using hooks, as highlighted in this issue, where the use of get_run_logger
fails due to a lack of active flow or task run context.
It would be useful to look at your error details and flow configuration to have a better understanding of the environment and the circumstances under which this error is produced. Without a specific error message or context about the task triggering the TerminationSignal
, it's a bit difficult to pinpoint the cause.
Since the function works when not defined as a Prefect task, it's possible that the runtime environment or context when running as a Prefect task differs from when it is run as a standalone function.
To resolve this issue, you might consider the following:
1. Ensure your environment is consistent between local runs and when running as a Prefect task.
2. Examine your flow and task configurations to make sure there aren't any unintended cancellations.
3. Review task dependencies and potential resource constraints.
4. Check for any differences in the code paths between standalone function execution and when running as a Prefect task.
If you need help with a specific code snippet, I can look for Prefect code examples related to your task setup. Otherwise, it might be helpful to create a new issue on the PrefectHQ GitHub repository with details of your setup and the error if none of the existing issues cover your scenario.