示例#1
0
def call_xenon(job,
               n_processes=1,
               cache="cache.json",
               user_name="x2sun",
               adapter="slurm",
               queue_name=None,
               host_name="cartesius.surfsara.nl",
               workdir=None,
               timeout=60000,
               **kwargs):
    """
    See :
        https://github.com/NLeSC/Xenon-examples/raw/master/doc/tutorial/xenon-tutorial.pdf
    """
    dict_properties = {
        "slurm": {
            "xenon.adaptors.slurm.ignore.version": "true"
        },
        "pbs": {
            "xenon.adaptors.pbs.ignore.version": "true"
        },
    }
    with XenonKeeper(log_level="DEBUG") as Xe:
        certificate = Xe.credentials.newCertificateCredential(
            "ssh", os.environ["HOME"] + "/.ssh/id_rsa", user_name, "", None)

        xenon_config = XenonConfig(
            jobs_scheme=adapter,
            location=host_name,
            credential=certificate,
            jobs_properties=dict_properties[adapter],
        )
        print(xenon_config.__dict__)

        if workdir is None:
            workdir = "/home/" + user_name

        job_config = RemoteJobConfig(
            registry=registry,
            init=plams.init,
            finish=plams.finish,
            queue=queue_name,
            time_out=timeout,
            working_dir=workdir,
        )

        with NCDisplay() as display:
            result = run_xenon_prov(job,
                                    Xe,
                                    cache,
                                    n_processes,
                                    xenon_config,
                                    job_config,
                                    display=display)

    return result
示例#2
0
def call_xenon(job,
               n_processes=1,
               cache='cache.json',
               user_name='x2sun',
               adapter='slurm',
               queue_name=None,
               host_name='cartesius.surfsara.nl',
               workdir=None,
               timeout=60000,
               **kwargs):
    """
    See :
        https://github.com/NLeSC/Xenon-examples/raw/master/doc/tutorial/xenon-tutorial.pdf
    """
    dict_properties = {
        'slurm': {
            'xenon.adaptors.slurm.ignore.version': 'true'
        },
        'pbs': {
            'xenon.adaptors.pbs.ignore.version': 'true'
        }
    }
    with XenonKeeper(log_level='DEBUG') as Xe:
        certificate = Xe.credentials.newCertificateCredential(
            'ssh', os.environ["HOME"] + '/.ssh/id_rsa', user_name, '', None)

        xenon_config = XenonConfig(jobs_scheme=adapter,
                                   location=host_name,
                                   credential=certificate,
                                   jobs_properties=dict_properties[adapter])
        print(xenon_config.__dict__)

        if workdir is None:
            workdir = '/home/' + user_name

        job_config = RemoteJobConfig(registry=registry,
                                     init=plams.init,
                                     finish=plams.finish,
                                     queue=queue_name,
                                     time_out=timeout,
                                     working_dir=workdir)

        with NCDisplay() as display:
            result = run_xenon_prov(job,
                                    Xe,
                                    cache,
                                    n_processes,
                                    xenon_config,
                                    job_config,
                                    display=display)

    return result