def __init__(self, params): ''' Constructor ''' self.descriptors = [] for obj in params: self.descriptors.append(OutputDescriptor(obj))
def fetch_experiment_output(self, exp_uuid, output_id): api_url = '{0}experiments/{1}/outputs/{2}'.format( self.base_url, exp_uuid, output_id) response = requests.get(api_url, headers=headers) if response.status_code == 200: return TspClientResponse( OutputDescriptor(json.loads(response.content.decode('utf-8'))), response.status_code, response.text) else: print("failed to get tree: {0}".format(response.status_code)) return TspClientResponse(None, response.status_code, response.text)
def __init__(self, params, model_type): self.model_type = model_type ''' Constructor ''' ''' Model returned in the response ''' self.model = params.get(MODEL_KEY) if MODEL_KEY in params: if self.model_type == ModelType.TIME_GRAPH_TREE: self.model = EntryModel(params.get(MODEL_KEY), self.model_type) elif self.model_type == ModelType.XY_TREE: # TODO print("not implemented") elif self.model_type == ModelType.STATES: # TODO print("not implemented") elif self.model_type == ModelType.XY: # TODO print("not implemented") ''' Output descriptor ''' if OUTPUT_DESCRIPTOR_KEY in params: self.output = OutputDescriptor(params.get(OUTPUT_DESCRIPTOR_KEY)) else: self.output = None ''' Response status as described by ResponseStatus ''' if RESPONSE_STATUS_KEY in params: self.status = ResponseStatus(params.get(RESPONSE_STATUS_KEY)) else: self.status = ResponseStatus.FAILED ''' Message associated with the response ''' if STATUS_MESSAGE_KEY in params: self.status = params.get(STATUS_MESSAGE_KEY) else: self.status = ""
def fetch_experiment_output(self, exp_uuid, output_id): ''' Fetch given output descriptor :param exp_uuid: Experiment UUID :param output_id: Output ID :param parameters: Query object :returns: :class: `TspClientResponse <OutputDescriptor>` object OutputDescriptor :rtype: TspClientResponse ''' api_url = '{0}experiments/{1}/outputs/{2}'.format( self.base_url, exp_uuid, output_id) response = requests.get(api_url, headers=headers) if response.status_code == 200: return TspClientResponse(OutputDescriptor(json.loads(response.content.decode('utf-8'))), response.status_code, response.text) else: # pragma: no cover print("failed to get tree: {0}".format(response.status_code)) return TspClientResponse(None, response.status_code, response.text)