Exemple #1
0
from openapi_client.models import V0036JobSubmission as jobSubmission
from openapi_client.models import V0036JobProperties as jobProperties
from openapi_client.api import SlurmApi as slurm
from pprint import pprint

s = slurm(openapi_client.ApiClient(openapi_client.Configuration()))
env = {
	"PATH": os.getenv("PATH", "/usr/local/bin:/bin:/usr/bin/:/usr/local/bin/"),
	"LD_LIBRARY_PATH": os.getenv("LD_LIBRARY_PATH", "/usr/local/lib64:/usr/local/lib/:/lib/:/lib64/:/usr/local/lib"),
	"SHELL": os.getenv("SHELL", "/bin/sh")
}
script = "#!/bin/env sh\nsrun uptime"
job = jobSubmission(script=script)
job.job = jobProperties(
	environment=env,
	current_working_directory=os.getcwd(),
	nodes=[2,9999],
	array="1-100%2",
)

try:
	njob = s.slurmctld_submit_job(job)
	pprint(njob)

	pprint(s.slurmctld_get_job(njob.job_id))
	pprint(s.slurmctld_cancel_job(njob.job_id, signal="KILL"))
	pprint(s.slurmctld_get_job(njob.job_id))

except ApiException as e:
	print("Exception when calling: %s\n" % e)
	os._exit(1)
Exemple #2
0
import os
import openapi_client
from openapi_client.rest import ApiException
from openapi_client.models import V0036JobSubmission as jobSubmission
from openapi_client.models import V0036JobProperties as jobProperties
from openapi_client.api import SlurmApi as slurm
from pprint import pprint
s = slurm(openapi_client.ApiClient(openapi_client.Configuration()))
env = {
    "PATH":
    os.getenv("PATH", "/usr/local/bin:/bin:/usr/bin/:/usr/local/bin/"),
    "LD_LIBRARY_PATH":
    os.getenv("LD_LIBRARY_PATH",
              "/usr/local/lib64:/usr/local/lib/:/lib/:/lib64/:/usr/local/lib"),
    "SHELL":
    os.getenv("SHELL", "/bin/sh")
}
script = "#!/bin/env sh\nsrun sleep 100"
job = jobSubmission(script=script)
job.job = jobProperties(environment=env,
                        current_working_directory=os.getcwd(),
                        nodes=[2, 3],
                        array="1000",
                        dependency="singleton")
try:
    njob = s.slurmctld_submit_job(job)
    pprint(njob)
except ApiException as e:
    print("Exception when calling: %s\n" % e)
    os._exit(1)
Exemple #3
0
import os
import openapi_client
from openapi_client.rest import ApiException
from openapi_client.models import V0037JobSubmission as jobSubmission
from openapi_client.models import V0037JobProperties as jobProperties
from openapi_client.api import SlurmApi as slurm
from pprint import pprint

s = slurm(openapi_client.ApiClient(openapi_client.Configuration()))
env = {
	"PATH": os.getenv("PATH", "/usr/local/bin:/bin:/usr/bin/:/usr/local/bin/"),
	"LD_LIBRARY_PATH": os.getenv("LD_LIBRARY_PATH", "/usr/local/lib64:/usr/local/lib/:/lib/:/lib64/:/usr/local/lib"),
	"SHELL": os.getenv("SHELL", "/bin/sh")
}
script = "#!/bin/env sh\nsrun uptime"
job = jobSubmission(script=script)
job.job = jobProperties(
	environment=env,
	current_working_directory=os.getcwd(),
	nodes=[2,9999],
	standard_error="/tmp/job.log",
)
try:
	njob = s.slurmctld_submit_job(job)
	pprint(njob)
except ApiException as e:
	print("Exception when calling: %s\n" % e)
	os._exit(1)

os._exit(0)
Exemple #4
0
s = slurm(openapi_client.ApiClient(openapi_client.Configuration()))
env = {
    "PATH":
    os.getenv("PATH", "/usr/local/bin:/bin:/usr/bin/:/usr/local/bin/"),
    "LD_LIBRARY_PATH":
    os.getenv("LD_LIBRARY_PATH",
              "/usr/local/lib64:/usr/local/lib/:/lib/:/lib64/:/usr/local/lib"),
    "SHELL":
    os.getenv("SHELL", "/bin/sh")
}
script = "#!/bin/env sh\nsrun uptime"
job = jobSubmission(script=script)
job.jobs = [
    jobProperties(
        environment=env,
        current_working_directory=os.getcwd(),
        nodes=[2, 3],
    ),
    jobProperties(
        environment=env,
        current_working_directory=os.getcwd(),
        nodes=[2, 4],
    ),
    jobProperties(
        environment=env,
        current_working_directory=os.getcwd(),
        nodes=[2, 5],
    ),
]
try:
    njob = s.slurmctld_submit_job(job)