Skip to content

Commit dc9e56b

Browse files
authored
Add actor reboot method to the RunClient (#140)
1 parent 52b211f commit dc9e56b

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

docs/docs.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,7 @@ Sub-client for manipulating a single actor run.
19641964
* [wait\_for\_finish()](#runclient-wait\_for\_finish)
19651965
* [metamorph()](#runclient-metamorph)
19661966
* [resurrect()](#runclient-resurrect)
1967+
* [reboot()](#runclient-reboot)
19671968
* [dataset()](#runclient-dataset)
19681969
* [key\_value\_store()](#runclient-key\_value\_store)
19691970
* [request\_queue()](#runclient-request\_queue)
@@ -2108,6 +2109,22 @@ Run status will be updated to RUNNING and its container will be restarted with t
21082109

21092110
***
21102111

2112+
#### [](#runclient-reboot) `RunClient.reboot()`
2113+
2114+
Reboot an Actor run. Only runs that are running, i.e. runs with status RUNNING can be rebooted.
2115+
2116+
[https://docs.apify.com/api/v2#/reference/actor-runs/reboot-run/reboot-run](https://docs.apify.com/api/v2#/reference/actor-runs/reboot-run/reboot-run)
2117+
2118+
* **Returns**
2119+
2120+
The Actor run data.
2121+
2122+
* **Return type**
2123+
2124+
`dict`
2125+
2126+
***
2127+
21112128
#### [](#runclient-dataset) `RunClient.dataset()`
21122129

21132130
Get the client for the default dataset of the actor run.
@@ -4416,6 +4433,7 @@ Async sub-client for manipulating a single actor run.
44164433
* [async wait\_for\_finish()](#runclientasync-wait\_for\_finish)
44174434
* [async metamorph()](#runclientasync-metamorph)
44184435
* [async resurrect()](#runclientasync-resurrect)
4436+
* [async reboot()](#runclientasync-reboot)
44194437
* [dataset()](#runclientasync-dataset)
44204438
* [key\_value\_store()](#runclientasync-key\_value\_store)
44214439
* [request\_queue()](#runclientasync-request\_queue)
@@ -4560,6 +4578,22 @@ Run status will be updated to RUNNING and its container will be restarted with t
45604578

45614579
***
45624580

4581+
#### [](#runclientasync-reboot) `async RunClientAsync.reboot()`
4582+
4583+
Reboot an Actor run. Only runs that are running, i.e. runs with status RUNNING can be rebooted.
4584+
4585+
[https://docs.apify.com/api/v2#/reference/actor-runs/reboot-run/reboot-run](https://docs.apify.com/api/v2#/reference/actor-runs/reboot-run/reboot-run)
4586+
4587+
* **Returns**
4588+
4589+
The Actor run data.
4590+
4591+
* **Return type**
4592+
4593+
`dict`
4594+
4595+
***
4596+
45634597
#### [](#runclientasync-dataset) `RunClientAsync.dataset()`
45644598

45654599
Get the client for the default dataset of the actor run.

src/apify_client/clients/resource_clients/run.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,20 @@ def resurrect(
155155

156156
return parse_date_fields(_pluck_data(response.json()))
157157

158+
def reboot(self) -> Dict:
159+
"""Reboot an Actor run. Only runs that are running, i.e. runs with status RUNNING can be rebooted.
160+
161+
https://docs.apify.com/api/v2#/reference/actor-runs/reboot-run/reboot-run
162+
163+
Returns:
164+
dict: The Actor run data.
165+
"""
166+
response = self.http_client.call(
167+
url=self._url('reboot'),
168+
method='POST',
169+
)
170+
return parse_date_fields(_pluck_data(response.json()))
171+
158172
def dataset(self) -> DatasetClient:
159173
"""Get the client for the default dataset of the actor run.
160174
@@ -349,6 +363,20 @@ async def resurrect(
349363

350364
return parse_date_fields(_pluck_data(response.json()))
351365

366+
async def reboot(self) -> Dict:
367+
"""Reboot an Actor run. Only runs that are running, i.e. runs with status RUNNING can be rebooted.
368+
369+
https://docs.apify.com/api/v2#/reference/actor-runs/reboot-run/reboot-run
370+
371+
Returns:
372+
dict: The Actor run data.
373+
"""
374+
response = await self.http_client.call(
375+
url=self._url('reboot'),
376+
method='POST',
377+
)
378+
return parse_date_fields(_pluck_data(response.json()))
379+
352380
def dataset(self) -> DatasetClientAsync:
353381
"""Get the client for the default dataset of the actor run.
354382

0 commit comments

Comments
 (0)