当前位置: 首页>>代码示例>>Python>>正文


Python subprocess32.call方法代码示例

本文整理汇总了Python中subprocess32.call方法的典型用法代码示例。如果您正苦于以下问题:Python subprocess32.call方法的具体用法?Python subprocess32.call怎么用?Python subprocess32.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在subprocess32的用法示例。


在下文中一共展示了subprocess32.call方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fastq_bwa_mem_piped

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def fastq_bwa_mem_piped(fastqs,i,j,t,rg,out_dir,ref_path):
    output = ''
    bam = out_dir+'/'+fastqs[0].rsplit('/')[-1].rsplit('.fq')[0].rsplit('_')[0]+'.%s.bam'%j
    piped_mem = [bwa_mem,'-M','-t %s'%t,'-R',r"'%s'"%rg,ref_path,
                 '<(%s -f %s -i %s -j %s)'%(route,fastqs[0],i,j),
                 '<(%s -f %s -i %s -j %s)'%(route,fastqs[1],i,j),
                 '|',samtools_view,'-Sb','-','-@ %s'%t,
                 '|',sambamba_sort,'-t %s'%t,'--tmpdir=%s/temp'%out_dir,'-o',bam,'/dev/stdin']  #-@ for threads here
    try:#bwa mem call here-------------------------------------------
        output += subprocess.check_output(' '.join(piped_mem),
                                          stderr=subprocess.STDOUT,
                                          executable='/bin/bash',
                                          shell=True)
        output += subprocess.check_output(['rm','-rf','%s/temp'%out_dir])
    except Exception as E:
        output += str(E) #error on the call-------------------------
    return bam #list of bam files to merge into next step

    
#|| by number of fastq files presented 
开发者ID:TheJacksonLaboratory,项目名称:SVE,代码行数:22,代码来源:bwa_split.py

示例2: call

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def call(cmdline, environ=(), **kwargs):
    """Runs command wrapping subprocess.call.

    :param cmdline:
        Command to run
    :type cmdline:
        ``list``
    :param environ:
        *optional* Environ variable to set prior to running the command
    :type environ:
        ``dict``
    """
    _LOGGER.debug('run: %r', cmdline)
    args = _alias_command(cmdline)

    # Setup a copy of the environ with the provided overrides
    cmd_environ = dict(os.environ.items())
    cmd_environ.update(environ)

    rc = subprocess.call(args, close_fds=_CLOSE_FDS, env=cmd_environ, **kwargs)

    _LOGGER.debug('Finished, rc: %d', rc)
    return rc 
开发者ID:Morgan-Stanley,项目名称:treadmill,代码行数:25,代码来源:subproc.py

示例3: run_cmd

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def run_cmd(cmd):
    out = []

    fh = NamedTemporaryFile(delete=False)
    es = subprocess.call(cmd, stdin=None,
            stdout=fh, stderr=subprocess.STDOUT, shell=True)
    fh.close()
    with open(fh.name, 'r') as f:
        for line in f:
            out.append(line.rstrip('\n'))
    os.unlink(fh.name)

    if (es != 0):
        print "[-] Non-zero exit status '%d' for CMD: '%s'" % (es, cmd)
        for line in out:
            print line

    return es, out 
开发者ID:mrash,项目名称:Wireguard-macOS-LinuxVM,代码行数:20,代码来源:wg-routes.py

示例4: grabLicence

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def grabLicence(self):
            """
            Returns True if a CPLEX licence can be obtained.
            The licence is kept until releaseLicence() is called.
            """
            status = ctypes.c_int()
            # If the config file allows to do so (non null params), try to
            # grab a runtime license.
            if ilm_cplex_license and ilm_cplex_license_signature:
                runtime_status = CPLEX_DLL.lib.CPXsetstaringsol(
                        ilm_cplex_license,
                        ilm_cplex_license_signature)
                # if runtime_status is not zero, running with a runtime
                # license will fail. However, no error is thrown (yet)
                # because the second call might still succeed if the user
                # has another license. Let us forgive bad user
                # configuration:
                if not (runtime_status == 0) and self.msg:
                    print(
                    "CPLEX library failed to load the runtime license" +
                    "the call returned status=%s" % str(runtime_status) +
                    "Please check the pulp config file.")
            self.env = CPLEX_DLL.lib.CPXopenCPLEX(ctypes.byref(status))
            self.hprob = None
            if not(status.value == 0):
                raise PulpSolverError("CPLEX library failed on " +
                                    "CPXopenCPLEX status=" + str(status)) 
开发者ID:QuantEcon,项目名称:MatchingMarkets.py,代码行数:29,代码来源:solvers.py

示例5: up_node1

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def up_node1():
    subproc.check_call(['vagrant', 'destroy', '-f', 'node1'])
    subproc.check_call(['vagrant', 'up', 'node1', '--no-provision'])
    yield "node1 is ready"

    print("Destroying node1...")
    subproc.call(['vagrant', 'destroy', '-f', 'node1'])
    print("Node1 is destroyed.") 
开发者ID:laincloud,项目名称:lain,代码行数:10,代码来源:conftest.py

示例6: up_node2

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def up_node2():
    subproc.check_call(['vagrant', 'destroy', '-f', 'node2'])
    subproc.check_call(['vagrant', 'up', 'node2'])
    yield "node2 is ready"

    print("Destroying node2...")
    subproc.call(['vagrant', 'destroy', '-f', 'node2'])
    print("Node2 is destroyed.") 
开发者ID:laincloud,项目名称:lain,代码行数:10,代码来源:conftest.py

示例7: up_node3

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def up_node3():
    subproc.check_call(['vagrant', 'destroy', '-f', 'node3'])
    subproc.check_call(['vagrant', 'up', 'node3'])
    yield "node3 is ready"

    print("Destroying node3...")
    subproc.call(['vagrant', 'destroy', '-f', 'node3'])
    print("Node3 is destroyed.") 
开发者ID:laincloud,项目名称:lain,代码行数:10,代码来源:conftest.py

示例8: run_cmd

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def run_cmd(self, cmd, collect, env=None):

        out = []

        if self.args.verbose:
            self.logr("    CMD: %s" % cmd)

        fh = None
        if self.args.disable_cmd_redirection or collect == self.Want_Output:
            fh = open(self.cov_paths['tmp_out'], 'w')
        else:
            fh = open(os.devnull, 'w')

        if env is None:
            subprocess.call(cmd, stdin=None,
                            stdout=fh, stderr=subprocess.STDOUT, shell=True, executable='/bin/bash')
        else:
            subprocess.call(cmd, stdin=None,
                            stdout=fh, stderr=subprocess.STDOUT, shell=True, env=env, executable='/bin/bash')

        fh.close()

        if self.args.disable_cmd_redirection or collect == self.Want_Output:
            with open(self.cov_paths['tmp_out'], 'r') as f:
                for line in f:
                    out.append(line.rstrip('\n'))

        return out 
开发者ID:test-pipeline,项目名称:orthrus,代码行数:30,代码来源:afl_sancov.py

示例9: Dedup_Sort

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def Dedup_Sort(in_bam, mem, threads):
    # Mark duplications
    st = stage.Stage('picard_mark_duplicates',dbc)
    dedup_bam = st.run(run_id,{'.bam':in_bam,'mem':mem})
    if (dedup_bam == False):
        print "ERROR: picard_mark_duplicates fails"
    else:
        subprocess.call(["mv",dedup_bam,in_bam])
        # Sort bam
        st = stage.Stage('sambamba_index',dbc)
        st.run(run_id,{'.bam':[in_bam],'threads':threads}) 
开发者ID:TheJacksonLaboratory,项目名称:SVE,代码行数:13,代码来源:sve.py

示例10: windows_kill

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def windows_kill(self):
        subprocess.call(['taskkill', '/F', '/IM', 'chromedriver.exe', '/T']) 
开发者ID:NetEaseGame,项目名称:ATX,代码行数:4,代码来源:chromedriver.py

示例11: _do_exec

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def _do_exec(self):
        return subprocess32.call(self.monitor['args'], timeout=self.monitor['timeout']) == 0 
开发者ID:AlekseyChudov,项目名称:powergslb,代码行数:4,代码来源:check.py

示例12: actualSolve

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def actualSolve(self, lp):
        """Solve a well formulated lp problem"""
        if not self.executable(self.path):
            raise PulpSolverError("PuLP: cannot execute "+self.path)
        if not self.keepFiles:
            pid = os.getpid()
            tmpLp = os.path.join(self.tmpDir, "%d-pulp.lp" % pid)
            tmpSol = os.path.join(self.tmpDir, "%d-pulp.sol" % pid)
        else:
            tmpLp = lp.name+"-pulp.lp"
            tmpSol = lp.name+"-pulp.sol"
        lp.writeLP(tmpLp, writeSOS = 0)
        proc = ["glpsol", "--cpxlp", tmpLp, "-o", tmpSol]
        if not self.mip: proc.append('--nomip')
        proc.extend(self.options)

        self.solution_time = clock()
        if not self.msg:
            proc[0] = self.path
            pipe = open(os.devnull, 'w')
            if operating_system == 'win':
                # Prevent flashing windows if used from a GUI application
                startupinfo = subprocess.STARTUPINFO()
                startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                rc = subprocess.call(proc, stdout = pipe, stderr = pipe,
                                     startupinfo = startupinfo)
            else:
                rc = subprocess.call(proc, stdout = pipe, stderr = pipe)
            if rc:
                raise PulpSolverError("PuLP: Error while trying to execute "+self.path)
        else:
            if os.name != 'nt':
                rc = os.spawnvp(os.P_WAIT, self.path, proc)
            else:
                rc = os.spawnv(os.P_WAIT, self.executable(self.path), proc)
            if rc == 127:
                raise PulpSolverError("PuLP: Error while trying to execute "+self.path)
        self.solution_time += clock()

        if not os.path.exists(tmpSol):
            raise PulpSolverError("PuLP: Error while executing "+self.path)
        lp.status, values = self.readsol(tmpSol)
        lp.assignVarsVals(values)
        if not self.keepFiles:
            try: os.remove(tmpLp)
            except: pass
            try: os.remove(tmpSol)
            except: pass
        return lp.status 
开发者ID:QuantEcon,项目名称:MatchingMarkets.py,代码行数:51,代码来源:solvers.py

示例13: display_config

# 需要导入模块: import subprocess32 [as 别名]
# 或者: from subprocess32 import call [as 别名]
def display_config(args, conf):
    '''Display args and conf settings'''

    # Don't call validate here as stockfish should be validated from update_config.
    stockfish_command = conf_get(conf, "StockfishCommand")

    print()
    print("### Checking configuration ...")
    print()
    print("Python:           %s (with requests %s)" % (platform.python_version(), requests.__version__))
    print("EngineDir:        %s" % get_engine_dir(conf))
    print("StockfishCommand: %s" % stockfish_command)
    print("Key:              %s" % (("*" * len(get_key(conf))) or "(none)"))

    cores = validate_cores(conf_get(conf, "Cores"))
    print("Cores:            %d" % cores)

    threads = validate_threads_per_process(conf_get(conf, "ThreadsPerProcess"), conf)
    instances = max(1, cores // threads)
    print("Engine processes: %d (each ~%d threads)" % (instances, threads))
    memory = validate_memory(conf_get(conf, "Memory"), conf)
    print("Memory:           %d MB" % memory)
    endpoint = get_endpoint(conf)
    warning = "" if endpoint.startswith("https://") else " (WARNING: not using https)"
    print("Endpoint:         %s%s" % (endpoint, warning))
    user_backlog, system_backlog = validate_backlog(conf)
    print("UserBacklog:      %ds" % user_backlog)
    print("SystemBacklog:    %ds" % system_backlog)
    print("FixedBackoff:     %s" % parse_bool(conf_get(conf, "FixedBackoff")))
    print()

    if conf.has_section("Stockfish") and conf.items("Stockfish"):
        print("Using custom UCI options is discouraged:")
        for name, value in conf.items("Stockfish"):
            if name.lower() == "hash":
                hint = " (use --memory instead)"
            elif name.lower() == "threads":
                hint = " (use --threads-per-process instead)"
            else:
                hint = ""
            print(" * %s = %s%s" % (name, value, hint))
        print()

    if args.ignored_threads:
        print("Ignored deprecated option --threads. Did you mean --cores?")
        print()

    return cores, threads, instances, memory, user_backlog, system_backlog 
开发者ID:niklasf,项目名称:fishnet,代码行数:50,代码来源:fishnet.py


注:本文中的subprocess32.call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。