예제 #1
0
 def register(self, service_type, service_name, service_location):
     endpoint = f"/register/{service_type}/{service_name}/{service_location}"
     data = remote_call(self.location, endpoint)
     return data is not None
예제 #2
0
 def locate(self, service_name):
     endpoint = f"/locate/{service_name}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('location')
     return None
예제 #3
0
 def list(self):
     endpoint = f"/list"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('services')
     return None
예제 #4
0
 def setnodes(self, ci_name, nodelist):
     endpoint = f"/setnodes/{ci_name}"
     data = remote_call(self.location, endpoint, payload=nodelist)
     return data is not None
예제 #5
0
 def task(self, task_id):
     endpoint = f"/task/{task_id}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('status'), data.get('nodelist'), data.get('nnodes')
     return 'error', None, None
예제 #6
0
 def terminate(self, task_id):
     endpoint = f"/terminate/{task_id}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('output')
     return None
예제 #7
0
 def cancel(self, task_id):
     endpoint = f"/cancel/{task_id}"
     data = remote_call(self.location, endpoint)
     return data is not None
예제 #8
0
 def extractnodes(self, task_id):
     endpoint = f"/extractnodes/{task_id}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('nodelist')
     return None
예제 #9
0
 def reservenodes(self, ci_name, nnodes, node_type):
     endpoint = f"/reservenodes/{ci_name}/{nnodes}/{node_type}"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('task_id')
     return None
예제 #10
0
 def tasklist(self):
     endpoint = f"/tasklist"
     data = remote_call(self.location, endpoint)
     if data is not None:
         return data.get('tasks')
     return None