prefect icon indicating copy to clipboard operation
prefect copied to clipboard

[task scheduling] add `TaskServer.execute_task_run`

Open zzstoatzz opened this issue 2 years ago • 1 comments

this PR adds an execute_task_run method that runs a TaskServer for the duration of a single task run, which is very convenient for testing and other one-off use of the TaskServer

after some engine / task_runner exploration / learning with @abrookins, in the short term we were able to make a couple small resource management improvements

Notes (afaict)

  • without calling .result() on the PrefectFuture we get back from submit_autonomous_task_run_to_engine, wait is never called on the ConcurrentTaskRunner, so we never exit the EngineContext (whereas with SequentialTaskRunner, we needn't call .result() because we're not waiting for an Event to be set)
  • it may be prudent to use wait_for_task_runs_and_report_crashes in some way with the PrefectFuture instances we get back in TaskServer instead of the current approach of start_soon for each PrefectFuture._result

zzstoatzz avatar Feb 15 '24 23:02 zzstoatzz

Deploy Preview for prefect-docs-preview ready!

Name Link
Latest commit 90f52df23eb5975589ba33c6b1f1911a9c7edf86
Latest deploy log https://app.netlify.com/sites/prefect-docs-preview/deploys/65cf8af8323fac0008b6957d
Deploy Preview https://deploy-preview-12002--prefect-docs-preview.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Feb 15 '24 23:02 netlify[bot]