예제 #1
0
def condor_release(specifiers):
    """Release condor job(s)."""

    logger.debug("releasing condor job(s) matched by %s", specifiers)

    try:
        cargo.check_call_capturing(["condor_release"] + map(str, specifiers))
    except subprocess.CalledProcessError:
        return False
    else:
        return True
예제 #2
0
def condor_rm(specifier):
    """Kill condor job(s)."""

    logger.debug("killing condor jobs matched by %s", specifier)

    try:
        cargo.check_call_capturing(["condor_rm", str(specifier)])
    except subprocess.CalledProcessError:
        return False
    else:
        return True
예제 #3
0
파일: __init__.py 프로젝트: buhman/borg
    def __init__(self, path):
        self.path = path
        self.support_paths = {}

        with open(path) as opb_file:
            self.header = instance.parse_opb_file_header(opb_file.readline())

        (self.raw_M, self.raw_N, self.nonlinear) = self.header

        if self.nonlinear:
            linearizer = os.path.join(borg.defaults.solvers_root, "PBSimple/PBlinearize")
            (linearized, _) = cargo.check_call_capturing([linearizer, self.path])
            (fd, self.linearized_path) = tempfile.mkstemp(suffix = ".opb")
            self.support_paths["linearized"] = self.linearized_path

            with os.fdopen(fd, "w") as linearized_file:
                linearized_file.write(linearized)

            logger.info("wrote linearized instance to %s", self.linearized_path)
        else:
            self.linearized_path = path

        with borg.accounting() as accountant:
            with open(self.linearized_path) as opb_file:
                self.opb = instance.parse_opb_file_linear(opb_file)

        logger.info("parsing took %.2f s", accountant.total.cpu_seconds)
예제 #4
0
def condor_submit(submit_path):
    """Submit to condor; return the cluster number."""

    (stdout, stderr) = cargo.check_call_capturing(["/usr/bin/env", "condor_submit", submit_path])
    expression = r"(\d+) job\(s\) submitted to cluster (\d+)\."
    match = re.match(expression , stdout.splitlines()[-1])

    if match:
        (jobs, cluster) = map(int, match.groups())

        logger.info("submitted %i condor jobs to cluster %i", jobs, cluster)

        return cluster
    else:
        raise RuntimeError("failed to submit to condor:%s" % stdout)
예제 #5
0
def condor_hold(specifiers):
    """Hold condor job(s)."""

    logger.debug("holding condor job(s) matched by %s", specifiers)

    cargo.check_call_capturing(["/usr/bin/env", "condor_hold"] + map(str, specifiers))