def by_tool_input(self, trans, tool_id, param_dump=None, job_state='ok', is_workflow_step=False): """Search for jobs producing same results using the 'inputs' part of a tool POST.""" user = trans.user input_data = defaultdict(list) input_ids = defaultdict(dict) def populate_input_data_input_id(path, key, value): """Traverses expanded incoming using remap and collects input_ids and input_data.""" if key == 'id': path_key = get_path_key(path[:-2]) current_case = param_dump for p in path: current_case = current_case[p] src = current_case['src'] input_data[path_key].append({'src': src, 'id': value}) input_ids[src][value] = True return key, value return key, value remap(param_dump, visit=populate_input_data_input_id) return self.__search(tool_id=tool_id, user=user, input_data=input_data, job_state=job_state, param_dump=param_dump, input_ids=input_ids, is_workflow_step=is_workflow_step)
def summarize_job_outputs(job: model.Job, tool, params, security): outputs = defaultdict(list) output_labels = {} possible_outputs = ( ('hda', 'dataset_id', job.output_datasets), ('ldda', 'ldda_id', job.output_library_datasets), ('hdca', 'dataset_collection_id', job.output_dataset_collection_instances), ) for src, attribute, output_associations in possible_outputs: for output_association in output_associations: output_name = output_association.name if output_name not in output_labels and tool: tool_output = tool.output_collections if src == 'hdca' else tool.outputs output_labels[output_name] = get_output_name( tool=tool, output=tool_output.get(output_name), params=params) label = output_labels.get(output_name) outputs[output_name].append({ 'label': label, 'value': { 'src': src, 'id': security.encode_id(getattr(output_association, attribute)) } }) return outputs
def by_tool_input(self, trans, tool_id, tool_version, param=None, param_dump=None, job_state='ok'): """Search for jobs producing same results using the 'inputs' part of a tool POST.""" user = trans.user input_data = defaultdict(list) def populate_input_data_input_id(path, key, value): """Traverses expanded incoming using remap and collects input_ids and input_data.""" if key == 'id': path_key = get_path_key(path[:-2]) current_case = param_dump for p in path: current_case = current_case[p] src = current_case['src'] current_case = param for i, p in enumerate(path): if p == 'values' and i == len(path) - 2: continue if isinstance(current_case, (list, dict)): current_case = current_case[p] identifier = getattr(current_case, "element_identifier", None) input_data[path_key].append({'src': src, 'id': value, 'identifier': identifier, }) return key, "__id_wildcard__" return key, value wildcard_param_dump = remap(param_dump, visit=populate_input_data_input_id) return self.__search(tool_id=tool_id, tool_version=tool_version, user=user, input_data=input_data, job_state=job_state, param_dump=param_dump, wildcard_param_dump=wildcard_param_dump)