Skip to content

Commit

Permalink
Merge pull request #15 from PrefectHQ/tmp-dir
Browse files Browse the repository at this point in the history
Remove temporary directory and fix dot start
  • Loading branch information
desertaxle committed Aug 24, 2023
2 parents d8bbd34 + bdf5ec2 commit 3d0582b
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/prefect/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import signal
import subprocess
import sys
import tempfile

import anyio
import anyio.abc
Expand Down Expand Up @@ -157,19 +156,13 @@ async def run(
_use_threaded_child_watcher()
flow_run_logger.info("Opening process...")

# TODO: expose working dir as configurable on the runner
with tempfile.TemporaryDirectory(suffix="prefect") as working_dir:
flow_run_logger.debug(
f"Process running command: {command} in {working_dir}"
)
process = await run_process(
command.split(" "),
stream_output=True,
task_status=task_status,
cwd=working_dir,
env=prepare_environment(flow_run),
**kwargs,
)
process = await run_process(
command.split(" "),
stream_output=True,
task_status=task_status,
env=prepare_environment(flow_run),
**kwargs,
)

# Use the pid for display if no name was given
display_name = f" {process.pid}"
Expand Down Expand Up @@ -336,7 +329,7 @@ async def check_for_cancelled_flow_runs(self):
# To stop loop service checking for cancelled runs.
# Need to find a better way to stop runner spawned by
# a worker.
if not self._flow_run_process_map:
if not self._flow_run_process_map and not self.deployment_ids:
raise Exception("No flow runs to watch for cancel.")

self.logger.debug("Checking for cancelled flow runs...")
Expand Down

0 comments on commit 3d0582b

Please sign in to comment.