コード例 #1
0
ファイル: test_client.py プロジェクト: kellrott/agro
 def test_connect(self):
     channel = implementations.insecure_channel('localhost', 9713)
     print "Connected"
     stub = agro_pb2.beta_create_Scheduler_stub(channel)
     
     task_ids = []
     for i in range(5):
         task = agro_pb2.Task()
         task_id = str(uuid.uuid4())
         task.id = task_id
         task_ids.append(task_id)
         task.command = "/bin/echo"
         
         task.args.add( arg="Testing" )
         task.args.add( arg="Hello" )
         task.args.add( arg="World" )
         task.args.add( arg="%s" % (i) )            
         task.container = "ubuntu"
         task.tags.extend( ['testing'] )
         print "Adding task"
         stub.AddTask(task, 10)
     
     for a in stub.SearchTasks(agro_pb2.TagArray(tags=[]), 10):
         print "Found", a
     
     count = 0
     c = pyagro.wait(stub, task_ids)
     assert(c == 0)
     print "Quiting"
     channel = None
     stub = None
     
     #import pdb; pdb.set_trace()
     
コード例 #2
0
ファイル: test_run.py プロジェクト: kellrott/agro
    def test_docker_client(self):
        channel = implementations.insecure_channel(self.agro_server, 9713)
        
        print "Connected"
        sched = agro_pb2.beta_create_Scheduler_stub(channel)
        
        task = agro_pb2.Task()
        task_id = str(uuid.uuid4())
        task.id = task_id
        task.command = "/usr/local/bin/docker"
        task.container = "docker"
        task.requirements.extend( [agro_pb2.TaskRequirement(
            name="docker_socket",
            value="/var/run/docker.sock"
        ) ] )

        task.args.add( arg="images" )
        print "Adding task"
        sched.AddTask(task, 10)
        print "Waiting"
        e = pyagro.wait(sched, task_id)
        assert(e == 0)
        
        sched = None
        filestore = None
        
コード例 #3
0
ファイル: test_run.py プロジェクト: kellrott/agro
    def test_program(self):
        #channel = implementations.insecure_channel('localhost', 9713)
        channel = implementations.insecure_channel(self.agro_server, 9713)
        
        print "Connected"
        sched = agro_pb2.beta_create_Scheduler_stub(channel)
        filestore = agro_pb2.beta_create_FileStore_stub(channel)
        
        task = agro_pb2.Task()
        task_id = str(uuid.uuid4())
        task.id = task_id
        task.command = "/usr/bin/md5sum"
        task.container = "ubuntu"
        file_id = str(uuid.uuid4())
        
        pyagro.upload_file(filestore, file_id, os.path.join(BASE_DIR, "..", "README"))
        
        task.args.add( file_arg=agro_pb2.FileArgument(
            id=file_id, 
            input=True, 
            silent=False,
            type=agro_pb2.FileArgument.PATH),
        )
        output_uuid = str(uuid.uuid4())
        task.args.add( file_arg=agro_pb2.FileArgument(
            id=output_uuid, 
            input=False,
            silent=False,
            type=agro_pb2.FileArgument.STDOUT),
        ) 
        task.tags.extend( ['testing'] )
        print "Adding task"
        sched.AddTask(task, 10)

        e = pyagro.wait(sched, task_id)
        assert(e == 0)
        print "Result File", output_uuid
        
        sched = None
        filestore = None
コード例 #4
0
ファイル: __init__.py プロジェクト: kellrott/agro
 def scheduler(self):
     stub = agro_pb2.beta_create_Scheduler_stub(self.channel)
     return AgroScheduler(stub)