示例#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 test_ssh_job_submission():
    with XenonKeeper() as x:
        certificate = x.credentials.newCertificateCredential(
            'ssh', path + '/id_rsa', 'joe', '', None)

        config = XenonConfig(jobs_scheme='ssh',
                             location='0.0.0.0:10022',
                             credential=certificate)

        perform_submission(x, config)
示例#3
0
def test_slurm_job_submission():
    with XenonKeeper() as x:
        certificate = x.credentials.newCertificateCredential(
            'ssh', path + '/id_rsa', 'joe', '', None)

        config = XenonConfig(
            jobs_scheme='slurm',
            location='0.0.0.0:10022',
            credential=certificate,
            jobs_properties={'xenon.adaptors.slurm.ignore.version': 'true'})

        perform_submission(x, config)
示例#4
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
示例#5
0
def test_xenon_42():
    A = log_add(1, 1)
    B = sub(3, A)

    multiples = [mul(log_add(i, B), A) for i in range(6)]
    C = accumulate(noodles.gather(*multiples))

    xenon_config = XenonConfig(jobs_scheme='local')

    job_config = RemoteJobConfig(registry=serial.base, time_out=1000)

    with XenonKeeper() as Xe, NCDisplay() as display:
        result = run_xenon(C,
                           Xe,
                           "cache.json",
                           2,
                           xenon_config,
                           job_config,
                           display=display)

    assert (result == 42)
示例#6
0
# returns a set of results object containing the output of
# each point in the scan
lt = PES_scan([dftb, adf], settings, cnc, scan)

# Gets the object presenting the molecule
# with the maximum energy calculated from the scan
apprTS = select_max(lt, "energy")

# Run the TS optimization, using the default TS template
workflow = adf(templates.ts.overlay(settings), apprTS.molecule)

from noodles.run.xenon import (XenonKeeper, XenonConfig, RemoteJobConfig,
                               run_xenon)

with XenonKeeper() as Xe:
    xenon_config = XenonConfig(jobs_scheme='slurm', location=None)

    job_config = RemoteJobConfig(
        registry=registry,
        prefix='/home/jhidding/venv',

        # the working_dir should exist and contain a file called worker.sh
        working_dir='/home/jhidding/qm-test',
        init=init,
        finish=finish,
        time_out=1)

    ts = run_xenon(Xe, 1, xenon_config, job_config, workflow)

# Retrieve the molecular coordinates
mol = ts.molecule