utils.py 文件源码

python
阅读 40 收藏 0 点赞 0 评论 0

项目:ISB-CGC-pipelines 作者: isb-cgc 项目源码 文件源码
def editPipeline(args, config):
        pipelineDbUtils = PipelineDbUtils(config)

        request = json.loads(pipelineDbUtils.getJobInfo(select=["request"], where={"job_id": args.jobId})[0].request)

        _, tmp = mkstemp()
        with open(tmp, 'w') as f:
            f.write("{data}".format(data=json.dumps(request, indent=4)))

        if "EDITOR" in os.environ.keys():
            editor = os.environ["EDITOR"]
        else:
            editor = "/usr/bin/nano"

        if subprocess.call([editor, tmp]) == 0:
            with open(tmp, 'r') as f:
                request = json.load(f)

            pipelineDbUtils.updateJob(args.jobId, keyName="job_id", setValues={"request": json.dumps(request)})
        else:
            print "ERROR: there was a problem editing the request"
            exit(-1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号