コード例 #1
0
def test_cross_path_loading3() -> None:
    try:
        # this should fail since the descriptor and executor are under different paths
        JobExecutor.get_instance('p2-tp3')
        assert False
    except ValueError as ve:
        assert 'Unable to load executor' in str(ve)
コード例 #2
0
def test_cross_path_loading2() -> None:
    try:
        # this should fail since the descriptor and executor are under different paths
        # despite the executor being in the same package as p1-tp1 which should load
        JobExecutor.get_instance('p2-tp1')
        assert False
    except ValueError as ve:
        assert 'Unable to load executor' in str(ve)
コード例 #3
0
def test_executor_loading() -> None:
    je1 = JobExecutor.get_instance('_always_loads')
    assert je1 is not None

    try:
        JobExecutor.get_instance('_never_loads')
        assert False
    except Exception:
        pass
コード例 #4
0
def test_cross_path_loading1() -> None:
    JobExecutor.get_instance('p1-tp1')
コード例 #5
0
#!/usr/bin/env python3

# This is meant as a simple test file to check if psij was installed successfully

import sys

from psij import Job, JobExecutor, JobSpec

if __name__ == '__main__':
    name = 'local'
    url = None

    if len(sys.argv) > 1:
        name = sys.argv[1]

    if len(sys.argv) > 2:
        url = sys.argv[2]

    jobs = list()
    job = Job(JobSpec(executable='/bin/date'))
    ex = JobExecutor.get_instance(name=name, url=url)
    ex.submit(job)
    jobs.append(job)
    print('Job submitted')
    status = job.wait()
    print('Job done: {}'.format(status))
コード例 #6
0
def _get_executor_instance(ep: ExecutorTestParams, job: Job) -> JobExecutor:
    assert job.spec is not None
    job.spec.launcher = ep.launcher
    job.spec.attributes = JobAttributes(custom_attributes=ep.custom_attributes)
    return JobExecutor.get_instance(ep.executor, url=ep.url)
コード例 #7
0
def test_executor_version(name: str = 'local') -> None:
    ex = JobExecutor.get_instance(name)
    assert isinstance(ex.version, Version)
コード例 #8
0
def _print_status() -> None:
    print('*** Plugin status ***')
    JobExecutor._print_plugin_status()
    Launcher._print_plugin_status()