Skip to content

Commit

Permalink
proc: clarify that ProcessManager.run returns a task signature
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrowla committed May 30, 2022
1 parent fed89bd commit 202850e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dvc_task/proc/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,26 @@ def processes(self) -> Generator[Tuple[str, "ProcessInfo"], None, None]:
except KeyError:
continue

def run(
def run_signature(
self,
args: Union[str, List[str]],
name: Optional[str] = None,
task: Optional[str] = None,
env: Optional[Dict[str, str]] = None,
immutable: bool = False,
) -> Signature:
"""Return a task which would run the given command in the background.
"""Return signature for a task which runs a command in the background.
Arguments:
args: Command to run.
name: Optional name to use for the spawned process.
task: Optional name of Celery task to use for spawning the process.
Defaults to 'dvc_task.proc.tasks.run'.
env: Optional environment to be passed into the process.
immutable: True if the returned Signature should be immutable.
Returns:
Celery signature for the run task.
"""
name = name or uuid()
task = task or "dvc_task.proc.tasks.run"
Expand All @@ -109,6 +114,7 @@ def run(
"wdir": os.path.join(self.wdir, name),
"env": env,
},
immutable=immutable,
)

def send_signal(self, name: str, sig: int):
Expand Down

0 comments on commit 202850e

Please sign in to comment.