Hi <@U021J8TU753> I've deployed my flow into an a...
# ask-community
c
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\handlers.py", line 70, in emit
    self.doRollover()
  File "\\v-tm-qeq-05\Prefect\lib\logging\handlers.py", line 171, in doRollover
    self.rotate(self.baseFilename, dfn)
  File "\\v-tm-qeq-05\Prefect\lib\logging\handlers.py", 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\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "\\v-tm-qeq-05\Prefect\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "\\v-tm-qeq-05\Prefect\Scripts\prefect.exe\__main__.py", line 7, in <module>
    sys.exit(app())
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\typer\main.py", line 311, in __call__
    return get_command(self)(*args, **kwargs)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\typer\core.py", line 778, in main
    return _main(
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\typer\core.py", line 216, in _main
    rv = self.invoke(ctx)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\typer\main.py", line 683, in wrapper
    return callback(**use_params)  # type: ignore
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\cli\_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\utilities\asyncutils.py", line 260, in coroutine_wrapper
    return call()
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\_internal\concurrency\calls.py", line 234, in __call__
    coro = self.run()
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\_internal\concurrency\calls.py", line 163, in run
    return self.context.run(asyncio.run, self._run_async(coro))
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\base_events.py", line 603, in run_until_complete
    self.run_forever()
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\windows_events.py", line 316, in run_forever
    super().run_forever()
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\base_events.py", line 570, in run_forever
    self._run_once()
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\base_events.py", line 1859, in _run_once
    handle._run()
  File "\\v-tm-qeq-05\Prefect\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\agent.py", line 490, in _submit_run_and_capture_errors
    result = await infrastructure.run(task_status=task_status)
  File "\\v-tm-qeq-05\Prefect\lib\site-packages\prefect\infrastructure\process.py", line 163, in run
    self.logger.error(
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.
1
Bump - Any advice would be appreciated! 🙂
1
s
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