Charles Leung

06/28/2023, 5:36 PM
Hi @Prefect I've deployed my flow into an agent, but when executing the deployment on the UI, it looks like it keeps throwing this error (grabbed from the console of the agent that flow is running from). It looks like the process is trying to access the logging flow at the same time because the tasks within the flow are being executed concurrently. I've also attached the flow and tasks for reference below. Not sure if this is a bug, or something else. Error:
Copy code
--- Logging error ---
Traceback (most recent call last):
  File "\\v-tm-qeq-05\Prefect\lib\logging\", line 70, in emit
  File "\\v-tm-qeq-05\Prefect\lib\logging\", line 171, in doRollover
    self.rotate(self.baseFilename, dfn)
  File "\\v-tm-qeq-05\Prefect\lib\logging\", line 111, in rotate
    os.rename(source, dest)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\qtask\\prefect.log' -> 'C:\\Users\\qtask\\prefect.log.1'
Call stack:
  File "\\v-tm-qeq-05\Prefect\lib\", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "\\v-tm-qeq-05\Prefect\lib\", line 87, in _run_code
    exec(code, run_globals)
  File "\\v-tm-qeq-05\Prefect\Scripts\prefect.exe\", line 7, in <module>
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\typer\", line 311, in __call__
    return get_command(self)(*args, **kwargs)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\typer\", line 778, in main
    return _main(
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\typer\", line 216, in _main
    rv = self.invoke(ctx)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\", line 760, in invoke
    return __callback(*args, **kwargs)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\typer\", line 683, in wrapper
    return callback(**use_params)  # type: ignore
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\cli\", line 41, in wrapper
    return fn(*args, **kwargs)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\utilities\", line 260, in coroutine_wrapper
    return call()
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\_internal\concurrency\", line 234, in __call__
    coro =
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\_internal\concurrency\", line 163, in run
    return, self._run_async(coro))
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\", line 44, in run
    return loop.run_until_complete(main)
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\", line 603, in run_until_complete
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\", line 316, in run_forever
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\", line 570, in run_forever
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\", line 1859, in _run_once
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\", line 81, in _run, *self._args)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\", line 490, in _submit_run_and_capture_errors
    result = await
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\infrastructure\", line 163, in run
Message: "Process 'wandering-panda' exited with status code: 3221225477"
Arguments: ()
10:21:22.906 | ERROR   | prefect.infrastructure.process - Process 'wandering-panda' exited with status code: 3221225477
10:21:22.969 | INFO    | prefect.agent - Reported flow run '7c18182d-631b-428a-bf7e-d0b631d86dd9' as crashed: Flow run infrastructure exited with non-zero status code 3221225477.
Bump - Any advice would be appreciated! 🙂

Sahil Rangwala

06/29/2023, 4:43 PM
If there are weird race conditions that are happening with the default concurrent task runner, I would recommend exploring other task runners (Such as the sequential task runner) and then organize your flow code accordingly to separate out both workflows (concurrent + sequential) to test it further
🙌 1