Skip to content

Commit 95eafcb

Browse files
author
Alan Christie
committed
feat: Creating instances now adds instance-directory property to step record
1 parent ad00205 commit 95eafcb

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

tests/wapi_adapter.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,17 @@ def create_instance(self, *, running_workflow_step_id: str) -> dict[str, Any]:
377377

378378
with open(_INSTANCE_PICKLE_FILE, "wb") as pickle_file:
379379
Pickler(pickle_file).dump(instances)
380+
381+
# Use the instance ID as the step's instance-directory (prefixing with '.')
382+
with open(_RUNNING_WORKFLOW_STEP_PICKLE_FILE, "rb") as pickle_file:
383+
running_workflow_step = Unpickler(pickle_file).load()
384+
assert running_workflow_step_id in running_workflow_step
385+
running_workflow_step[running_workflow_step_id][
386+
"instance_directory"
387+
] = f".{instance_id}"
388+
with open(_RUNNING_WORKFLOW_STEP_PICKLE_FILE, "wb") as pickle_file:
389+
Pickler(pickle_file).dump(running_workflow_step)
390+
380391
UnitTestWorkflowAPIAdapter.lock.release()
381392

382393
return {"id": instance_id}

workflow/workflow_abc.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,6 @@ def get_workflow_steps_driving_this_step(
334334
# }
335335
# ]
336336
# }
337-
#
338-
# Additionally, if the step has started (an instance has been created)
339-
# each entry on the array of steps will contain a "instance_directory" property
340-
# that is the directory within the Project that's the step's working directory.
341-
#
342-
# "instance_directory": ".instance-00000000-0000-0000-0000-00000000000a",
343337

344338
@abstractmethod
345339
def get_instance(self, *, instance_id: str) -> tuple[dict[str, Any], int]:

0 commit comments

Comments
 (0)