You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**LambdaCron**offer 4 different type of task to run:
12
+
**LambdaCron**offers 4 different types of tasks:
13
13
14
14
***Queue task**: send message to AWS SQS queue.
15
-
***Lambda task**: invoke AWS lambda function.
15
+
***Lambda task**: invoke AWS Lambda function.
16
16
***Batch task**: submit AWS Batch job.
17
17
***HTTP task**: send HTTP requests (GET & POST).
18
18
19
19
Tasks are defined in YAML files and are stored in a S3 bucket.
20
20
21
21
## LambdaCron CLI
22
22
23
-
**LambdaCron** provide a CLI tool that allow to manage your cron tasks from you localhost,
24
-
no need to access to AWS console.
25
-
26
-
Also it allows to run multiple environments with different settings. As many environments
27
-
as desired can be set up.
23
+
**LambdaCron** provides a CLI tool that allows management of your cron tasks without access
24
+
to the AWS Console. It also allows creation of multiple environments with different settings.
28
25
29
26
### Settings
30
27
31
-
Custom settings for environments are set in a YAMLfile located in user home, it must be
32
-
called:**~/.lambda-cron.yml**.
28
+
Custom settings for environments are set in a YAML-formatted configuration file located in the
29
+
user home directory, and must be named**~/.lambda-cron.yml**.
33
30
34
31
There are 3 levels of preferences for settings:
35
32
36
33
* Environment: Custom values for an specific environment.
37
34
* Global: Custom values that will have effect to all environments created.
38
35
* Default: Default values in case no custom values are specified (by environment or globally)
39
36
40
-
Highest level of preference is *Environment*, followed by *Global* and finally *Default*. Each option
37
+
Highest level of preference is *Environment*, followed by *Global* and finally *Default*. Each option
41
38
in the settings can set the value from different levels. Higher level of preference overwrite lower levels.
42
39
43
-
Settings are saved in a YAML file. Each environment is defined with a root key in the YAML,
44
-
global settings are identified with the key *global*.
40
+
Each environment is defined with a root key in the YAML, while global settings are identified with the
41
+
key *global*.
45
42
46
43
Options available:
47
44
48
45
#### bucket
49
46
50
-
Name of the bucket where lambda function code will be hosted and tasks stored.
47
+
Name of the bucket where Lambda function code will be hosted and tasks stored.
51
48
52
49
```yaml
53
50
bucket: 'my-custom-bucket-name'
54
51
```
55
52
56
-
You can use the pattern **{environment}** in the string for the bucket, it will
53
+
You can use the macro, **{environment}**, in the string for the bucket, and it will
57
54
be replaced by the environment name.
58
55
59
-
**Defualt**: lambda-cron-{environment}
56
+
**Default**: lambda-cron-{environment}
60
57
61
-
The bucket will have to folders:
58
+
The bucket will have two folders:
62
59
63
60
* code/
64
61
* tasks/
65
62
66
63
#### every (frequency)
67
64
68
-
Frequency with which the lambda function that evaluate tasks will run.
69
-
It indicates the frequency by **minutes OR hours** with an integer number.
65
+
Frequency at which the Lambda function will execute to run tasks.
66
+
It indicates the frequency in **minutes OR hours** with an integer number.
70
67
It is specified with one of the following parameters:
71
68
72
69
* minutes
@@ -77,13 +74,13 @@ every:
77
74
minutes: 5
78
75
```
79
76
80
-
**Defualt**: every hour.
77
+
**Default**: every hour.
81
78
82
-
More info for [frequency](#frequency)
79
+
More info for [frequency](#frequency).
83
80
84
81
#### alarm
85
82
86
-
Alarm can be set up using CloudWatch metrics. It uses following parameters:
83
+
Alarm can be set up using CloudWatch metrics. It uses the following parameters:
87
84
88
85
* enabled
89
86
* email (Required if alarm is enabled).
@@ -94,17 +91,17 @@ alarm:
94
91
email: my-mailing-list@email.com
95
92
```
96
93
97
-
**Defualt**: not enabled.
94
+
**Default**: disabled.
98
95
99
96
#### enabled
100
97
101
-
It allows to enabled/disabled the cron (CloudWatch event).
98
+
It enables/disables the cron (CloudWatch event).
102
99
103
100
```yaml
104
101
enabled: True
105
102
```
106
103
107
-
**Defualt**: enabled.
104
+
**Default**: enabled.
108
105
109
106
#### Example
110
107
@@ -115,7 +112,7 @@ global:
115
112
prod:
116
113
alarm:
117
114
enabled: True
118
-
email: dev-alerts@domain.com
115
+
email: prod-alerts@domain.com
119
116
every:
120
117
minutes: 5
121
118
@@ -134,7 +131,7 @@ The settings for each environment will be:
134
131
* bucket: my-project-cron-prod
135
132
* alarm:
136
133
* enabled: True
137
-
* email: dev-alerts@domain.com
134
+
* email: prod-alerts@domain.com
138
135
* every:
139
136
* minutes: 5
140
137
@@ -153,14 +150,16 @@ The settings for each environment will be:
153
150
* alarm:
154
151
* enabled: False
155
152
* email: ''
156
-
153
+
157
154
### Commands
158
155
159
-
**LambdaCron** CLI use [aws-cli](https://github.com/aws/aws-cli), every command
160
-
is translated into aws-cli command. AWS account should be configured for aws-cli.
161
-
LambdaCron CLI allow to specify different aws-cli profiles.
156
+
The **LambdaCron** CLI uses the [AWS CLI](https://github.com/aws/aws-cli), and translates
157
+
every command into an AWS CLI command. The AWS account used should be configured for AWS
158
+
CLI access. The LambdaCron CLI allows different AWS CLI
159
+
[profiles](http://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html) to
160
+
be specified.
162
161
163
-
Following is the list of commands available.
162
+
The following is the list of commands available.
164
163
165
164
#### create
166
165
@@ -192,7 +191,7 @@ Parameters:
192
191
193
192
#### stop
194
193
195
-
Disable LambdaCron, it won't run until it is enabled (#start command)
194
+
Disable LambdaCron, and it won't run until it is enabled (#start command) again.
196
195
197
196
Parameters:
198
197
@@ -201,7 +200,7 @@ Parameters:
201
200
202
201
#### invoke
203
202
204
-
Invoke lambda function cron manually
203
+
Invoke Lambda function cron manually.
205
204
206
205
Parameters:
207
206
@@ -210,20 +209,20 @@ Parameters:
210
209
211
210
#### delete
212
211
213
-
Delete **LambdaCron** environment from the AWS account
212
+
Delete **LambdaCron** environment from the AWS account.
214
213
215
214
Parameters:
216
215
217
216
* **--environment (-e)**: Environment to work with (string)
218
217
* **--delete-bucket**: Flag to indicate that the bucket must be deleted from S3 (optional)
219
218
* **--aws-profile (-a)**: AWS profile to use from aws-cli (string) (optional)
220
219
221
-
Note: To delete de bucket it must be empty.
220
+
Note: The bucket must be empty before it can be deleted.
222
221
223
222
#### upload-tasks
224
223
225
-
Upload tasks to S3 bucket to run with lambda-cron. It will sync the directory
226
-
with S3 deleting tasks have been deleted from the local directory.
224
+
Upload tasks to S3 bucket to be run with LambdaCron. It will sync the directory
225
+
with S3, including deleting tasks have been deleted from the local directory.
227
226
228
227
Parameters:
229
228
@@ -244,20 +243,21 @@ Parameters:
244
243
245
244
## Tasks
246
245
247
-
Tasks are defined in YAML files, each task in an independent file. Task must follow
248
-
the json schema provided in this repo: [schema](./lambda_cron/schema.json).
246
+
Tasks are defined in YAML files, with each task in an independent file. A task must follow
247
+
the JSON schema provided in this repo: [schema](./lambda_cron/schema.json).
249
248
250
-
All tasks must contains following keys and values:
249
+
All tasks must contain the following keys and values:
251
250
252
251
* **name**: task name
253
252
* **expression**: crontab expression
254
253
* **task**: task definition (customized for each type of tasks)
255
254
256
-
For each kind of task there a set of specific keys a values to set. Described bellow.
255
+
Each type of task has its own set of required keys as described in the following section.
256
+
257
257
258
258
### Queue task
259
259
260
-
It sends a message to a AWS SQS queue.
260
+
It sends a message to an AWS SQS queue.
261
261
The task definition must contains following keys:
262
262
263
263
* **type**: *queue*
@@ -284,10 +284,10 @@ All parameters of the function will be supported soon.
284
284
### Lambda task
285
285
286
286
It invokes an AWS lambda functions.
287
-
The task definition must contains following keys:
287
+
The task definition must contain the following keys:
288
288
289
289
* **type**: *lambda*
290
-
* **FunctionName**: Name of the lambda function to invoke (string)
290
+
* **FunctionName**: Name of the Lambda function to invoke (string)
291
291
* **InvokeArgs**: arguments to send (YAML/JSON)
292
292
293
293
```yaml
@@ -301,12 +301,12 @@ task:
301
301
output: 's3://my-data-output/performance'
302
302
```
303
303
304
-
Function is invoked using [boto3 Lambda.Client.invoke_async](http://boto3.readthedocs.io/en/latest/reference/services/lambda.html#Lambda.Client.invoke_async)
304
+
The function is invoked using [boto3 Lambda.Client.invoke_async](http://boto3.readthedocs.io/en/latest/reference/services/lambda.html#Lambda.Client.invoke_async)
305
305
306
306
### Batch task
307
307
308
-
It submits AWS Batch Jobs.
309
-
The task definition must contains following keys:
308
+
It submits AWS Batch jobs.
309
+
The task definition must contain the following keys:
310
310
311
311
* **type**: *batch*
312
312
* **jobName**: name to assign to the job (string)
@@ -324,12 +324,12 @@ task:
324
324
```
325
325
326
326
It is a wrapper for [boto3 Batch.Client.submit_job](http://boto3.readthedocs.io/en/latest/reference/services/batch.html#Batch.Client.submit_job).
327
-
It means all parameters for the method can be set in the task definition.
327
+
All parameters for the method can be set in the task definition.
328
328
329
329
### HTTP task
330
330
331
-
It send and HTTP request (GET or POST).
332
-
The task definition must contains following keys:
331
+
It sends an HTTP request (GET or POST).
332
+
The task definition must contain the following keys:
333
333
334
334
* **type**: *http*
335
335
* **method**: http method (get | post)
@@ -348,24 +348,24 @@ task:
348
348
```
349
349
350
350
It is a wrapper over [Requests](http://docs.python-requests.org/en/master/).
351
-
All http methods will be supported soon.
351
+
All HTTP methods will be supported soon.
352
352
353
353
## Frequency
354
354
355
-
#### Execution time
355
+
#### Execution time
356
356
All tasks scheduled to run between the current event and the next event will be run immediately.
357
357
358
358
Example: LambdaCron runs every hour ('0 * * * *'), tasks '0 1 * * *' and '58 1 * * *' will run at the same time.
359
359
360
-
#### Task frequency
361
-
Lambda cron will execute a task at most once invocation. This can result in a task being run fewer times than it's cron expression implies.
360
+
#### Task frequency
361
+
LambdaCron will execute a task at most once for each invocation. This can result in a task being run fewer times than it's cron expression implies.
362
362
363
-
Example: If LambdaCron runs every hour ('0 * * * *'), a task '*/15 * * * *' will only run once an hour. If LambdaCron runs every minute ('* * * * *'), a task '*/15 * * * *' will only run four times an hour.
363
+
Example: If LambdaCron runs every hour ('0 * * * *'), a task '*/15 * * * *' will only run once an hour. If LambdaCron runs every minute ('* * * * *'), a task '*/15 * * * *' will only run four times an hour. You can set up LambdaCron to run more frequently than an hour if you need a task to be run more frequently.
364
364
365
365
#### Frequecy and Precision
366
366
367
367
Events are based on [AWS CloudWatch Events](http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html).
368
-
You can read in following [documentation](http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html):
368
+
You can learn about them in the [Scheduled Events documentation](http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html):
369
369
370
370
* "The finest resolution using a Cron expression is a minute"
371
371
* "Your scheduled rule is triggered within that minute, but not on the precise 0th second"
@@ -392,7 +392,7 @@ Be aware of this.
392
392
$ pip install lambda-cron
393
393
```
394
394
395
-
### Usage
395
+
### Usage
396
396
397
397
Create your first environment (called 'test') with default settings:
0 commit comments