Esempio n. 1
0
def lfs_setstripe_maybe(path='.', stripe=12):
    path = os.path.abspath(path)
    cmd = 'lfs setstripe -c {:d} {!s}'.format(stripe, path)
    try:
        capture(cmd)
        log.info(
            'Lustre filesystem detected. This lfs stripe ({}) should propagate to subdirs of {!r}.'
            .format(stripe, path))
    except Exception as exc:
        log.info('Apparently {!r} is not in lustre filesystem, which is fine.'.
                 format(path))
Esempio n. 2
0
 def submit(self, state, exe, script_fn):
     """Run in cwd, in background.
     Can raise.
     """
     run_dir = os.getcwd()
     job_name = self.get_job_name()
     #job_nproc = self.job_nproc
     #job_mb = self.job_mb
     #job_queue = self.job_queue
     # Add shebang, in case shell_start_mode=unix_behavior (for SGE).
     #   https://github.com/PacificBiosciences/FALCON/pull/348
     with open(script_fn, 'r') as original: data = original.read()
     with open(script_fn, 'w') as modified: modified.write("#!/bin/bash" + "\n" + data)
     mapping = dict(
             JOB_EXE='/bin/bash',
             JOB_NAME=job_name,
             #JOB_OPTS=JOB_OPTS,
             #JOB_QUEUE=job_queue,
             JOB_SCRIPT=script_fn, CMD=script_fn,
             JOB_DIR=run_dir, DIR=run_dir,
             JOB_STDOUT='stdout', STDOUT_FILE='stdout',
             JOB_STDERR='stderr', STDERR_FILE='stderr',
             #MB=pypeflow_mb,
             #NPROC=pypeflow_nproc,
     )
     mapping.update(self.job_dict)
     if 'JOB_OPTS' in mapping:
         # a special two-level mapping: ${JOB_OPTS} is substituted first
         mapping['JOB_OPTS'] = self.sub(mapping['JOB_OPTS'], mapping)
     sge_cmd = self.sub(self.submit_template, mapping)
     self.submit_capture = capture(sge_cmd)
Esempio n. 3
0
 def submit(self, state, exe, script_fn):
     """Run in cwd, in background.
     Can raise.
     """
     run_dir = os.getcwd()
     job_name = self.get_job_name()
     #job_nproc = self.job_nproc
     #job_mb = self.job_mb
     #job_queue = self.job_queue
     # Add shebang, in case shell_start_mode=unix_behavior (for SGE).
     #   https://github.com/PacificBiosciences/FALCON/pull/348
     with open(script_fn, 'r') as original: data = original.read()
     with open(script_fn, 'w') as modified: modified.write("#!/bin/bash" + "\n" + data)
     mapping = dict(
             JOB_EXE='/bin/bash',
             JOB_NAME=job_name,
             #JOB_OPTS=JOB_OPTS,
             #JOB_QUEUE=job_queue,
             JOB_SCRIPT=script_fn, CMD=script_fn,
             JOB_DIR=run_dir, DIR=run_dir,
             JOB_STDOUT='stdout', STDOUT_FILE='stdout',
             JOB_STDERR='stderr', STDERR_FILE='stderr',
             #MB=pypeflow_mb,
             #NPROC=pypeflow_nproc,
     )
     mapping.update(self.job_dict)
     if 'JOB_OPTS' in mapping:
         # a special two-level mapping: ${JOB_OPTS} is substituted first
         mapping['JOB_OPTS'] = self.sub(mapping['JOB_OPTS'], mapping)
     sge_cmd = self.sub(self.submit_template, mapping)
     self.submit_capture = capture(sge_cmd)
Esempio n. 4
0
def validate_config(config):
    # This simple and quick check catches common problems early.
    # This code might go somewhere else someday.
    smrt_bin_cmds = [
        'blasr', 'samtools', 'pbalign', 'variantCaller',
    ]
    path_cmds = [
        'nucmer',
        'show-coords',
        'fc_rr_hctg_track2.exe',
    ]
    LOG.info('PATH={}'.format(os.environ['PATH']))
    try:
        capture('which which')
    except Exception:
        LOG.warning('Could not find "which" command. Skipping checks for "blasr", etc.')
        return
    for cmd in smrt_bin_cmds + path_cmds:
        syscall('which ' + cmd)
    syscall('show-coords -h')
    syscall('nucmer --version')