Launcher
executor.engine.launcher.core.launcher(func=None, engine=None, async_mode=False, job_type='process', name=None, description=None, tags=None, job_attrs=None)
Create a launcher for a function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Optional[Union[Callable, Cmd2Func]]
|
The function to be launched. If the function is instance of
Cmd2Func,
the launcher will be in subprocess mode,
will launch |
None
|
engine
|
Optional[Engine]
|
The engine to use. If not specified, the default engine will be used. |
None
|
async_mode
|
bool
|
If True, the launcher will be AsyncLauncher. |
False
|
job_type
|
JOB_TYPES
|
The job type to use. Default is 'process'. |
'process'
|
name
|
Optional[str]
|
The name of the launcher. |
None
|
description
|
Optional[str]
|
The description of the launcher. |
None
|
tags
|
Optional[List[str]]
|
The tags of the launcher. |
None
|
job_attrs
|
Optional[dict]
|
The attributes for creating the job. |
None
|
Source code in executor/engine/launcher/core.py
executor.engine.launcher.core.LauncherBase
Bases: object
Source code in executor/engine/launcher/core.py
engine
property
writable
Get the engine of the launcher.
create_job(args, kwargs, **attrs)
Create a job from the launcher.
Source code in executor/engine/launcher/core.py
executor.engine.launcher.core.SyncLauncher
Bases: LauncherBase
Source code in executor/engine/launcher/core.py
async_mode
property
Check if the launcher is in async mode.
__call__(*args, **kwargs)
Submit a job to the engine and wait for the result.
submit(*args, **kwargs)
to_async()
Convert the launcher to async mode.
executor.engine.launcher.core.AsyncLauncher
Bases: LauncherBase
Source code in executor/engine/launcher/core.py
async_mode
property
Check if the launcher is in async mode.
__call__(*args, **kwargs)
async
Submit a job to the engine and wait for the result.
submit(*args, **kwargs)
async
to_sync()
Convert the launcher to sync mode.