Skip to content

Commit da7f8fe

Browse files
author
Alan Christie
committed
refactor: Removed unnecessary Task method & table
1 parent ea33e58 commit da7f8fe

File tree

3 files changed

+1
-35
lines changed

3 files changed

+1
-35
lines changed

tests/instance_launcher.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ def launch(self, launch_parameters: LaunchParameters) -> LaunchResult:
8080
running_workflow_step_id=launch_parameters.running_workflow_step_id
8181
)
8282
instance_id = response["id"]
83-
response = self._api_adapter.create_task()
84-
task_id = response["id"]
83+
task_id = "task-00000000-0000-0000-0000-000000000001"
8584

8685
# Apply variables to the step's Job command.
8786
job = self._api_adapter.get_job(

tests/test_test_api_adapter.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,3 @@ def test_create_and_get_instance():
265265

266266
# Assert
267267
assert response["running_workflow_step"] == "r-workflow-step-000"
268-
269-
270-
def test_create_task():
271-
# Arrange
272-
utaa = UnitTestWorkflowAPIAdapter()
273-
274-
# Act
275-
response = utaa.create_task()
276-
277-
# Assert
278-
assert "id" in response

tests/wapi_adapter.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
# Table UUID formats
3636
_INSTANCE_ID_FORMAT: str = "instance-00000000-0000-0000-0000-{id:012d}"
37-
_TASK_ID_FORMAT: str = "task-00000000-0000-0000-0000-{id:012d}"
3837
_WORKFLOW_DEFINITION_ID_FORMAT: str = "workflow-00000000-0000-0000-0000-{id:012d}"
3938
_RUNNING_WORKFLOW_ID_FORMAT: str = "r-workflow-00000000-0000-0000-0000-{id:012d}"
4039
_RUNNING_WORKFLOW_STEP_ID_FORMAT: str = (
@@ -49,7 +48,6 @@
4948
f"{_PICKLE_DIRECTORY}/running-workflow-step.pickle"
5049
)
5150
_INSTANCE_PICKLE_FILE: str = f"{_PICKLE_DIRECTORY}/instance.pickle"
52-
_TASK_PICKLE_FILE: str = f"{_PICKLE_DIRECTORY}/task.pickle"
5351

5452

5553
class UnitTestWorkflowAPIAdapter(WorkflowAPIAdapter):
@@ -74,7 +72,6 @@ def __init__(self):
7472
_RUNNING_WORKFLOW_PICKLE_FILE,
7573
_RUNNING_WORKFLOW_STEP_PICKLE_FILE,
7674
_INSTANCE_PICKLE_FILE,
77-
_TASK_PICKLE_FILE,
7875
]:
7976
with open(file, "wb") as pickle_file:
8077
Pickler(pickle_file).dump({})
@@ -282,22 +279,3 @@ def create_instance(self, *, running_workflow_step_id: str) -> dict[str, Any]:
282279
UnitTestWorkflowAPIAdapter.lock.release()
283280

284281
return {"id": instance_id}
285-
286-
def create_task(self) -> dict[str, Any]:
287-
UnitTestWorkflowAPIAdapter.lock.acquire()
288-
with open(_TASK_PICKLE_FILE, "rb") as pickle_file:
289-
tasks = Unpickler(pickle_file).load()
290-
291-
next_id: int = len(tasks) + 1
292-
task_id: str = _TASK_ID_FORMAT.format(id=next_id)
293-
record = {
294-
"done": False,
295-
"exit_code": 0,
296-
}
297-
tasks[task_id] = record
298-
299-
with open(_TASK_PICKLE_FILE, "wb") as pickle_file:
300-
Pickler(pickle_file).dump(tasks)
301-
UnitTestWorkflowAPIAdapter.lock.release()
302-
303-
return {"id": task_id}

0 commit comments

Comments
 (0)