Skip to content

Commit bc24277

Browse files
authored
Merge pull request #27 from mhuguesaws/bugfix/#26_job_states
Fix switched vcpus and memory value
2 parents 16af59f + c630c42 commit bc24277

File tree

1 file changed

+71
-8
lines changed

1 file changed

+71
-8
lines changed

src/batch-job-states.json

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,73 @@
5555
{
5656
"Variable": "$.LastEventType",
5757
"StringMatches": "RUNNING",
58-
"Next": "ChoicePlatform"
58+
"Next": "Set VCPU and MEMORY"
5959
}
6060
],
6161
"Default": "Success"
6262
},
63+
"Set VCPU and MEMORY":
64+
{
65+
"Type": "Choice",
66+
"Choices":
67+
[
68+
{
69+
"And":
70+
[
71+
{
72+
"Variable": "$$.Execution.Input.detail.container.resourceRequirements[1].type",
73+
"StringMatches": "VCPU"
74+
},
75+
{
76+
"Variable": "$$.Execution.Input.detail.container.resourceRequirements[0].type",
77+
"StringMatches": "MEMORY"
78+
}
79+
],
80+
"Next": "Set VCPU [1] and MEMORY [0]"
81+
},
82+
{
83+
"And":
84+
[
85+
{
86+
"Variable": "$$.Execution.Input.detail.container.resourceRequirements[0].type",
87+
"StringMatches": "VCPU"
88+
},
89+
{
90+
"Variable": "$$.Execution.Input.detail.container.resourceRequirements[1].type",
91+
"StringMatches": "MEMORY"
92+
}
93+
],
94+
"Next": "Set VCPU [0] and MEMORY [1]"
95+
}
96+
],
97+
"Default": "Fail"
98+
},
99+
"Set VCPU [0] and MEMORY [1]":
100+
{
101+
"Type": "Pass",
102+
"Next": "ChoicePlatform",
103+
"ResultPath": "$.Resource",
104+
"Parameters":
105+
{
106+
"VCPU.$": "$.Detail.container.resourceRequirements[0].value",
107+
"MEMORY.$": "$.Detail.container.resourceRequirements[1].value"
108+
}
109+
},
110+
"Set VCPU [1] and MEMORY [0]":
111+
{
112+
"Type": "Pass",
113+
"Next": "ChoicePlatform",
114+
"ResultPath": "$.Resource",
115+
"Parameters":
116+
{
117+
"VCPU.$": "$.Detail.container.resourceRequirements[1].value",
118+
"MEMORY.$": "$.Detail.container.resourceRequirements[0].value"
119+
}
120+
},
121+
"Fail":
122+
{
123+
"Type": "Fail"
124+
},
63125
"ChoicePlatform":
64126
{
65127
"Type": "Choice",
@@ -97,7 +159,8 @@
97159
}
98160
}
99161
},
100-
"Next": "DynamoDB PutItem EC2"
162+
"Next": "DynamoDB PutItem EC2",
163+
"ResultPath": "$.Instance"
101164
},
102165
"DynamoDB PutItem EC2":
103166
{
@@ -134,31 +197,31 @@
134197
},
135198
"vCPUs":
136199
{
137-
"N.$": "$$.Execution.Input.detail.container.resourceRequirements[0].value"
200+
"N.$": "$.Resource.VCPU"
138201
},
139202
"memory":
140203
{
141-
"N.$": "$$.Execution.Input.detail.container.resourceRequirements[1].value"
204+
"N.$": "$.Resource.MEMORY"
142205
},
143206
"containerInstanceArn":
144207
{
145208
"S.$": "$$.Execution.Input.detail.container.containerInstanceArn"
146209
},
147210
"purchaseOption":
148211
{
149-
"S.$": "$.Item.PurchaseOption.S"
212+
"S.$": "$.Instance.Item.PurchaseOption.S"
150213
},
151214
"instanceType":
152215
{
153-
"S.$": "$.Item.InstanceType.S"
216+
"S.$": "$.Instance.Item.InstanceType.S"
154217
},
155218
"availabilityZone":
156219
{
157-
"S.$": "$.Item.AvailabilityZone.S"
220+
"S.$": "$.Instance.Item.AvailabilityZone.S"
158221
},
159222
"instanceId":
160223
{
161-
"S.$": "$.Item.InstanceId.S"
224+
"S.$": "$.Instance.Item.InstanceId.S"
162225
},
163226
"platform":
164227
{

0 commit comments

Comments
 (0)