@rlyle1179/serverless-aws-batch 1.1.20 → 1.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/schedule.js +10 -1
- package/package.json +1 -1
- package/.vscode/settings.json +0 -5
package/lib/schedule.js
CHANGED
|
@@ -24,13 +24,22 @@ function getFormattedNow() {
|
|
|
24
24
|
+ "-" + zeroPad(currentDate.getSeconds());
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// JOB_DEFINITION_ARN is baked at deploy time as the full ARN including :revision. Reduce it to the
|
|
28
|
+
// bare job-definition name so SubmitJob resolves the latest ACTIVE revision: a deploy can leave the
|
|
29
|
+
// env pinned to a revision it just deregistered, which fails with "is not in ACTIVE status".
|
|
30
|
+
function toJobDefinitionName(arn) {
|
|
31
|
+
if (! arn) return arn;
|
|
32
|
+
const name = arn.includes('/') ? arn.slice(arn.lastIndexOf('/') + 1) : arn;
|
|
33
|
+
return name.replace(/:\d+$/, '');
|
|
34
|
+
}
|
|
35
|
+
|
|
27
36
|
module.exports.schedule = (event, context, callback) => {
|
|
28
37
|
|
|
29
38
|
if (process.env.EVENT_LOGGING_ENABLED === 'true') {
|
|
30
39
|
console.log(`Received event: ${JSON.stringify(event, null, 2)}`);
|
|
31
40
|
}
|
|
32
41
|
|
|
33
|
-
const jobDefinition = process.env.JOB_DEFINITION_ARN;
|
|
42
|
+
const jobDefinition = toJobDefinitionName(process.env.JOB_DEFINITION_ARN);
|
|
34
43
|
const jobName = `${process.env.FUNCTION_NAME}-${getFormattedNow()}`;
|
|
35
44
|
const jobQueue = process.env.JOB_QUEUE_ARN;
|
|
36
45
|
|
package/package.json
CHANGED