-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run the VIIRS climatology job the first 5 days of every month.
- Loading branch information
1 parent
66e96a9
commit 48e7446
Showing
2 changed files
with
57 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import datetime | ||
import json | ||
import os | ||
|
||
import boto3 | ||
|
||
batch_client = boto3.client("batch") | ||
|
||
|
||
jobQueue = os.getenv("JOB_QUEUE") | ||
jobDefinition = os.getenv("JOB_DEFINITION") | ||
lasrc_aux = os.getenv("LASRC_AUX_DIR") | ||
laads_token = os.getenv("LAADS_TOKEN") | ||
laads_bucket = os.getenv("LAADS_BUCKET") | ||
|
||
|
||
def handler(event, context): | ||
current_date = datetime.datetime.now() | ||
response = batch_client.submit_job( | ||
jobName="laads_cron", | ||
jobQueue=jobQueue, | ||
jobDefinition=jobDefinition, | ||
containerOverrides={ | ||
"environment": [ | ||
{"name": "LASRC_AUX_DIR", "value": lasrc_aux}, | ||
{"name": "LAADS_TOKEN", "value": laads_token}, | ||
{"name": "LAADS_BUCKET", "value": laads_bucket}, | ||
{"name": "CLIM_YEAR", "value": current_date.year}, | ||
{"name": "CLIM_MONTH", "value": current_date.month}, | ||
], | ||
"command": ["sh", "-c", "climatologies.sh"], | ||
}, | ||
) | ||
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters