MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / PythonEnv

Class PythonEnv

crates/pyhq/python/hyperqueue/task/function/__init__.py:65–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64
65class PythonEnv:
66 def __init__(
67 self,
68 python_bin: str = "python3",
69 prologue: Optional[str] = None,
70 shell: str = "bash",
71 ):
72 """
73 Describes an environment for spawning Python interpreters.
74 :param python_bin: Python binary that will be executed.
75 :param prologue: Shell command that will be executed prior to launching the Python interpreter.
76 :param shell: Shell used for executing `prologue`.
77 """
78 code = "from hyperqueue.task.function import task_main as m; m()"
79
80 if prologue:
81 self.args = [shell, "-c", f'{prologue}\n\n{python_bin} -c "{code}"']
82 else:
83 self.args = [python_bin, "-c", code]
84
85
86class PythonFunction(Task):

Callers 4

executeMethod · 0.90
create_clientMethod · 0.90
__init__Method · 0.85

Calls

no outgoing calls

Tested by 1