Skip to content

Commit

Permalink
var ref fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kedhammar committed Dec 20, 2024
1 parent 89c7a80 commit a7c65e6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/fetch_last_known_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def main(args):
lims = Lims(BASEURI, USERNAME, PASSWORD)
process = Process(lims, id=args.pid)

# Get the target UDF from the step field
# Get the name of the target UDF from the step field
target_udf = process.udf.get(args.step_udf, None)
assert (
target_udf is not None and target_udf != "None"
Expand All @@ -49,8 +49,8 @@ def main(args):
logging.info("Step has no output artifacts. Assigning to input artifact.")
else:
art_tuples: list[tuple[dict]] = process.input_output_maps
art_in2out: dict[Process.Artifact : Process.Artifact] = {
i["uri"]: o["uri"]
art_in2out: dict[str:Artifact] = {
i["uri"].id: o["uri"]
for i, o in art_tuples
if i["uri"].type == "Analyte" and o["uri"].type == "Analyte"
}
Expand All @@ -59,13 +59,13 @@ def main(args):
if no_outputs:
target_artifact = art_in
else:
target_artifact = art_in2out[art_in]
target_artifact = art_in2out[art_in.id]
logging.info(
f"Looking for last recorded UDF '{target_udf}' of {'input' if no_outputs else 'output'} artifact '{target_artifact.name}'..."
)
udf_value, udf_history = udf_tools.fetch_last(
currentStep=process,
art=art_in,
art=target_artifact,
target_udfs=target_udf,
use_current=False,
print_history=True,
Expand All @@ -77,11 +77,11 @@ def main(args):
target_artifact.udf[target_udf] = udf_value
target_artifact.put()
logging.info(
f"Updated UDF '{target_udf}' for '{art_in.name}' to '{udf_value}'"
f"Updated UDF '{target_udf}' for {'input' if no_outputs else 'output'} '{target_artifact.name}' to '{udf_value}'"
)
else:
logging.warning(
f"Could not traceback UDF '{target_udf}' for '{art_in.name}'"
f"Could not traceback UDF '{target_udf}' for {'input' if no_outputs else 'output'} artifact '{target_artifact.name}'"
)
logging.info(f"Traceback:\n{udf_history}")

Expand Down

0 comments on commit a7c65e6

Please sign in to comment.