molq
import json
from pathlib import Path
from molq import JobSpec, submit
local = submit("local", "local", project_root=Path.cwd())
@local
def hello(name):
job = yield JobSpec.argv(["echo", f"hello {name}"])
return job
job = hello("molq")
result = job.wait(timeout=30)
print(json.dumps(job.logs(), ensure_ascii=False))
local.close()
Scale
The same job on a cluster¶
Choose the allocation and account. Your SSH configuration handles the connection.
from molq import JobSpec, Resources, Scheduling, submit
hpc = submit("hpc", project_root="/shared/project")
@hpc
def simulate():
job = yield JobSpec.argv(
["python", "simulate.py"],
resources=Resources(tasks=1, cpus_per_task=4, time_limit_seconds=600),
scheduling=Scheduling(account="your-project"),
)
return job
job = simulate()
hpc.close()
Manual