@@ -0,0 +1,959 @@
+%22%22%22Utilities for interacting with codalab.%22%22%22%0Aimport collections%0Aimport subprocess%0Aimport sys%0A%0Afrom .. import log%0A%0ADOCKER_IMAGE = 'robinjia/robinjia-codalab:2.1.1'%0A%0Adef run(cmd, deps, name, description, queue='john', host=None, cpus=1,%0A        docker_image=DOCKER_IMAGE, is_theano=False, omp_num_threads=1,%0A        dry_run=False):%0A  params = collections.OrderedDict()%0A  if host:%0A    params%5B'--request-queue'%5D = 'host=%25s' %25 host%0A  else:%0A    params%5B'--request-queue'%5D = queue%0A  params%5B'--request-cpus'%5D = str(cpus)%0A  params%5B'--request-docker-image'%5D = docker_image%0A  params%5B'-n'%5D = name%0A  params%5B'-d'%5D = description%0A  param_list = %5Bx for k_v in params.iteritems() for x in k_v%5D%0A  if is_theano:%0A    prefix = 'OMP_NUM_THREADS=%25d THEANO_FLAGS=blas.ldflags=-lopenblas' %25 omp_num_threads%0A    cmd = prefix + ' ' + cmd%0A  call_args = %5B'cl', 'run'%5D + deps + %5Bcmd%5D + param_list%0A  if dry_run:%0A    log('Dry run: %25s' %25 str(call_args))%0A  else:%0A    subprocess.call(call_args)%0A

Add codalab run utility