Skip to content

Commit 9d92479

Browse files
authored
Merge pull request #39 from taskbadger/sk/update-libs
update lib and client
2 parents f1c66b8 + af20378 commit 9d92479

30 files changed

+483
-169
lines changed

taskbadger.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,11 @@ components:
710710
nullable: true
711711
description: Datetime when status is set to a terminal value.Can be set
712712
via the API.
713+
time_to_start:
714+
type: string
715+
nullable: true
716+
description: Duration between task creation and when status first changes
717+
from pending. (seconds)
713718
max_runtime:
714719
type: integer
715720
maximum: 2147483647
@@ -813,6 +818,11 @@ components:
813818
nullable: true
814819
description: Datetime when status is set to a terminal value.Can be set
815820
via the API.
821+
time_to_start:
822+
type: string
823+
nullable: true
824+
description: Duration between task creation and when status first changes
825+
from pending. (seconds)
816826
max_runtime:
817827
type: integer
818828
maximum: 2147483647
@@ -837,8 +847,8 @@ components:
837847
type: object
838848
additionalProperties:
839849
type: string
840-
maxLength: 255
841850
minLength: 2
851+
maxLength: 255
842852
description: Tags for the task represented as a mapping from 'namespace'
843853
to 'value'.
844854
required:
@@ -891,6 +901,11 @@ components:
891901
nullable: true
892902
description: Datetime when status is set to a terminal value.Can be set
893903
via the API.
904+
time_to_start:
905+
type: string
906+
nullable: true
907+
description: Duration between task creation and when status first changes
908+
from pending. (seconds)
894909
max_runtime:
895910
type: integer
896911
maximum: 2147483647

taskbadger/celery.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ def apply_async(self, *args, **kwargs):
131131

132132
result = super().apply_async(*args, **kwargs)
133133

134-
tb_task_id = result.info.get(TB_TASK_ID) if result.info else None
134+
info = result.info
135+
tb_task_id = info.get(TB_TASK_ID) if isinstance(info, dict) else None
135136
setattr(result, TB_TASK_ID, tb_task_id)
136137

137138
_get_task = functools.partial(get_task, tb_task_id) if tb_task_id else lambda: None
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""

taskbadger/internal/api/action_endpoints/action_cancel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def _get_kwargs(
2626
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
2727
if response.status_code == 204:
2828
return None
29+
2930
if client.raise_on_unexpected_status:
3031
raise errors.UnexpectedStatus(response.status_code, response.content)
3132
else:

taskbadger/internal/api/action_endpoints/action_create.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ def _get_kwargs(
2424
"url": f"/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/",
2525
}
2626

27-
_body = body.to_dict()
27+
_kwargs["json"] = body.to_dict()
2828

29-
_kwargs["json"] = _body
3029
headers["Content-Type"] = "application/json"
3130

3231
_kwargs["headers"] = headers
@@ -38,6 +37,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
3837
response_201 = Action.from_dict(response.json())
3938

4039
return response_201
40+
4141
if client.raise_on_unexpected_status:
4242
raise errors.UnexpectedStatus(response.status_code, response.content)
4343
else:

taskbadger/internal/api/action_endpoints/action_get.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
2929
response_200 = Action.from_dict(response.json())
3030

3131
return response_200
32+
3233
if client.raise_on_unexpected_status:
3334
raise errors.UnexpectedStatus(response.status_code, response.content)
3435
else:

taskbadger/internal/api/action_endpoints/action_list.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def _parse_response(
3434
response_200.append(response_200_item)
3535

3636
return response_200
37+
3738
if client.raise_on_unexpected_status:
3839
raise errors.UnexpectedStatus(response.status_code, response.content)
3940
else:

taskbadger/internal/api/action_endpoints/action_partial_update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ def _get_kwargs(
2626
"url": f"/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/{id}/",
2727
}
2828

29-
_body = body.to_dict()
29+
_kwargs["json"] = body.to_dict()
3030

31-
_kwargs["json"] = _body
3231
headers["Content-Type"] = "application/json"
3332

3433
_kwargs["headers"] = headers
@@ -40,6 +39,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
4039
response_200 = Action.from_dict(response.json())
4140

4241
return response_200
42+
4343
if client.raise_on_unexpected_status:
4444
raise errors.UnexpectedStatus(response.status_code, response.content)
4545
else:

taskbadger/internal/api/action_endpoints/action_update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ def _get_kwargs(
2626
"url": f"/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/{id}/",
2727
}
2828

29-
_body = body.to_dict()
29+
_kwargs["json"] = body.to_dict()
3030

31-
_kwargs["json"] = _body
3231
headers["Content-Type"] = "application/json"
3332

3433
_kwargs["headers"] = headers
@@ -40,6 +39,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
4039
response_200 = Action.from_dict(response.json())
4140

4241
return response_200
42+
4343
if client.raise_on_unexpected_status:
4444
raise errors.UnexpectedStatus(response.status_code, response.content)
4545
else:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""

0 commit comments

Comments
 (0)