def get_resolved_jbors(resolved_thing, orig_thing, resolved_jbors): if resolved_thing == orig_thing: return if is_job_ref(orig_thing): jbor_str = jbor_to_str(orig_thing) if jbor_str not in resolved_jbors: try: from dxpy.api import job_describe job_output = job_describe(get_job_from_jbor(orig_thing)).get('output') if job_output is not None: field_value = job_output.get(get_field_from_jbor(orig_thing)) jbor_index = get_index_from_jbor(orig_thing) if jbor_index is not None: if isinstance(field_value, list): resolved_jbors[jbor_str] = field_value[jbor_index] else: resolved_jbors[jbor_str] = field_value except: # Just don't report any resolved JBORs if there are # any problems pass elif isinstance(orig_thing, list): for i in range(len(orig_thing)): get_resolved_jbors(resolved_thing[i], orig_thing[i], resolved_jbors) elif isinstance(orig_thing, dict) and '$dnanexus_link' not in orig_thing: for key in orig_thing: get_resolved_jbors(resolved_thing[key], orig_thing[key], resolved_jbors)
def get_resolved_jbors(resolved_thing, orig_thing, resolved_jbors): if resolved_thing == orig_thing: return if is_job_ref(orig_thing): jbor_str = jbor_to_str(orig_thing) if jbor_str not in resolved_jbors: try: from dxpy.api import job_describe job_output = job_describe( get_job_from_jbor(orig_thing)).get('output') if job_output is not None: field_value = job_output.get( get_field_from_jbor(orig_thing)) jbor_index = get_index_from_jbor(orig_thing) if jbor_index is not None: if isinstance(field_value, list): resolved_jbors[jbor_str] = field_value[jbor_index] else: resolved_jbors[jbor_str] = field_value except: # Just don't report any resolved JBORs if there are # any problems pass elif isinstance(orig_thing, list): for i in range(len(orig_thing)): get_resolved_jbors(resolved_thing[i], orig_thing[i], resolved_jbors) elif isinstance(orig_thing, dict) and '$dnanexus_link' not in orig_thing: for key in orig_thing: get_resolved_jbors(resolved_thing[key], orig_thing[key], resolved_jbors)