or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

actors.mdbuilds.mdindex.mdlogging.mdrequest-queues.mdruns.mdschedules.mdstorage.mdstore.mdtasks.mdusers.mdwebhooks.md

schedules.mddocs/

0

# Scheduling

1

2

Schedule management for automated Actor and task executions with cron-like functionality. Schedules enable periodic execution of Actors and tasks.

3

4

## Capabilities

5

6

### Schedule Operations

7

8

```python { .api }

9

class ScheduleClient:

10

def get(self) -> dict | None:

11

"""Get schedule information."""

12

13

def update(self, **kwargs) -> dict:

14

"""Update schedule configuration.

15

16

Args:

17

name (str, optional): Schedule name

18

cron_expression (str, optional): Cron expression for timing

19

is_enabled (bool, optional): Whether schedule is active

20

actions (list, optional): Actions to execute

21

timezone (str, optional): Timezone for schedule

22

**kwargs: Additional schedule parameters

23

"""

24

25

def delete(self) -> None:

26

"""Delete schedule."""

27

28

def get_log(self) -> list | None:

29

"""Get schedule execution log."""

30

31

class ScheduleClientAsync:

32

"""Async version of ScheduleClient with identical methods."""

33

34

class ScheduleCollectionClient:

35

def list(

36

self,

37

*,

38

limit: int | None = None,

39

offset: int | None = None,

40

desc: bool | None = None

41

) -> ListPage[dict]:

42

"""List schedules.

43

44

Args:

45

limit: Maximum number of schedules

46

offset: Pagination offset

47

desc: Sort in descending order

48

"""

49

50

def create(self, **kwargs) -> dict:

51

"""Create new schedule.

52

53

Args:

54

name (str): Schedule name

55

cron_expression (str): Cron timing expression

56

is_enabled (bool, optional): Whether to enable immediately

57

actions (list): List of actions to execute

58

timezone (str, optional): Schedule timezone

59

**kwargs: Additional schedule configuration

60

"""

61

62

class ScheduleCollectionClientAsync:

63

"""Async version of ScheduleCollectionClient with identical methods."""

64

```

65

66

## Usage Examples

67

68

```python

69

from apify_client import ApifyClient

70

71

client = ApifyClient('your-api-token')

72

73

# Create daily schedule

74

schedule = client.schedules().create(

75

name='Daily Data Collection',

76

cron_expression='0 9 * * *', # Every day at 9 AM

77

is_enabled=True,

78

timezone='America/New_York',

79

actions=[{

80

'type': 'RUN_ACTOR_TASK',

81

'actorTaskId': 'my-task-id',

82

'input': {'date': '{{now}}'}

83

}]

84

)

85

86

print(f"Created schedule: {schedule['id']}")

87

88

# Monitor schedule executions

89

schedule_client = client.schedule(schedule['id'])

90

log = schedule_client.get_log()

91

92

for entry in log:

93

print(f"{entry['createdAt']}: {entry['status']}")

94

```