Parallel



In [ ]:
import buckyball as bb

Basic job launching

At its core, the ComputeCannon is all about launching jobs as easily as possible. Let's start by kicking off some basic linux commands.


In [ ]:
image = bb.compute.get_image_tag('opsin')

In [ ]:
def echo_stdout(job):
    print job.stdout

def return_stdout(job):
    return job.stdout.strip()

job = bb.compute.launch(image, 'echo "hello world"', name='Hello world', when_finished=return_stdout)
job.get_display_object()

In [ ]:
job.wait()

In [ ]:
mol.

In [ ]:
"""Test a function in a subprocess and with docker"""
def get_natoms(mol):
    return mol.natoms
python_call = bp.PythonCall(get_natoms,[mol],{})
job = bp.PythonJob(python_call,bpi.SubprocessJob,'buckyball/buckyball_base',{})
job.wait()
assert job.result == 3334

client = du.docker_machine_client()
job2 = bp.PythonJob(python_call,bpi.DockerJob,'buckyball/buckyball_base',{'config':{'client':client}})
job2.wait()
assert job.result == 3334