Пример #1
0
def load_modules(module_args):
    try:
        args = ['load']
        args.extend(module_args)
        module(args)
    except Exception as e:
        print("Could not load module: {}".format(e), file=sys.stderr)
Пример #2
0
def load_module(modules):
    try:
        module_loader.module('load', str(modules))
    except Exception as e:
        sys.stdout.write("""Could not load module {}.
                         This may result in a runtime error!
                         """.format(modules))
        sys.stdout.write("Exception: {}\n".format(str(e)))
Пример #3
0
def load_module(module_args):
    try:
        modules = ['load']
        modules.extend(module_args)
        module(modules)
    except Exception as e:
        sys.stdout.write("Could not load module {}\n\
                         This may result in a runtime error in the \
                         dispatched slurm jobs!\n".format(str(modules)))
        sys.stdout.write("Exception: {}\n".format(str(e)))
        raise e
Пример #4
0
def load_module(modules):
    try:
        args = ['load']
        args.extend(modules)
        module(args)
    except Exception as e:
        sys.stdout.write("""Could not load module(s) {}.
                         This may result in a runtime error!
                         """.format(str(modules)))
        sys.stdout.write("Exception: {}\n".format(str(e)))
        raise e
Пример #5
0
    def module_cmd(self, args):
        """
        Load environment modules using environment module system
        :return:
        """
        try:
            # first argument is always 'load'
            if type(self.modules) is list:
                args.extend(self.modules)  # add specified modules to arguments
            else:
                args.append(self.modules)

            module(args)  # call module system, using arguments ['load', '...']

            if self.verbose:
                print("Called modulecmd with args: {}".format(args))
        except (OSError, ValueError) as err:
            if self.verbose:
                print("Could not load: {}, {}".format(self.modules,
                                                      err),
                      file=stderr)
Пример #6
0
#!/usr/bin/env python
from __future__ import print_function

from Bash import bash
from module_loader import module

module('load', 'slurm')  # Import slurm from environment module system


def sbatch(command, *args):
    script = "echo '#!/usr/bin/env bash\n{}' | sbatch".format(command)

    for argument in args:
        script += " {}".format(argument)

    return (bash(script))


def squeue(*args):
    return (bash("squeue", *args))


def scancel(*args):
    return (bash("scancel", *args))


def scontrol(*args):
    return (bash("scontrol", *args))


def sjob(job):
Пример #7
0
#!/usr/bin/env python
from Bash import bash
from module_loader import module

module('load', 'torque', 'maui')


def qsub(command, *args):
    script = ("echo '#!/usr/bin/env bash\n{}' | qsub".format(command))

    for argument in args:
        script += " {}".format(argument)

    return (bash(script))


def qstat(*args):
    return (bash("qstat", *args))


def qjob(job):
    return (bash("qstat -j", job))


def qdel(*args):
    return (bash("qdel", *args))


def qalter(*args):
    return (bash("qalter", *args))