codalab.py 文件源码

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

项目:lang2program 作者: kelvinguu 项目源码 文件源码
def launch_job(job_name, cmd,
               dependencies=tuple(),
               queue='john', image='kelvinguu/gtd:1.0',
               memory=None, cpus='5',
               network=False,
               debug=False, tail=False):
    """Launch a job on CodaLab (optionally upload code that the job depends on).

    Args:
        job_name: name of the job
        cmd: command to execute
        dependencies: list of other bundles that we depend on
        debug: if True, prints SSH commands, but does not execute them
        tail: show the streaming output returned by CodaLab once it launches the job
    """
    print 'Remember to set up SSH tunnel and LOG IN through the command line before calling this.'
    options = '-v -n {} -w {} --request-queue {} --request-docker-image {} --request-cpus {}'.format(
        job_name, worksheet, queue, image, cpus)

    if memory:
        options += ' --request-memory {}'.format(memory)
    if network:
        options += ' --request-network'

    dep_str = ' '.join(['{0}:{0}'.format(dep) for dep in dependencies])
    full_cmd = "cl run {} {} '{}'".format(options, dep_str, cmd)
    if tail:
        full_cmd += ' -t'
    shell(full_cmd, verbose=True, debug=debug)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号