Skip to content

Commit

Permalink
chore: make TaskClient.create_task return created task
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemDoum committed Dec 5, 2024
1 parent 956c541 commit c1b84ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion icij-worker/icij_worker/task_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ async def create_task(
*,
id_: Optional[str] = None,
group: Optional[str] = None,
):
) -> Task:
if id_ is None:
id_ = _generate_task_id(name)
task = Task.create(task_id=id_, task_name=name, args=args)
url = f"/api/task/{id_}"
data = {"task": task, "group": group}
async with self._put(url, json=data):
pass
return task


def _generate_task_id(task_name: str) -> str:
Expand Down

0 comments on commit c1b84ef

Please sign in to comment.