Skip to content

Commit bf59d54

Browse files
committed
minor fixes
1 parent 4d3eabe commit bf59d54

5 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/api/handlers/job_api.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pylint: disable=too-many-lines,too-few-public-methods,too-many-locals,too-many-statements,too-many-branches
22
import os
33
import json
4-
import time
54
import uuid
65
import copy
76
import urllib
@@ -874,9 +873,6 @@ def post(self):
874873
build_arguments, deployments, limits_cpu, limits_memory, timeout,
875874
resources, json.dumps(job), job['cluster']['name']])
876875

877-
# to make sure the get picked up in the right order by the scheduler
878-
time.sleep(0.1)
879-
880876
g.db.commit()
881877
return "Successfully create jobs"
882878

src/job/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM docker:17.12.1-ce-dind
22

3-
ENV CLOUD_SDK_VERSION 198.0.0
3+
ENV CLOUD_SDK_VERSION 210.0.0
44
ENV PATH /google-cloud-sdk/bin:$PATH
55

66
RUN apk add --no-cache \

src/job/infrabox_job/job.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,14 @@ def create_jobs(self, jobs):
9494
}
9595

9696
while True:
97-
r = requests.post("%s/create_jobs" % self.api_server,
98-
headers=self.get_headers(),
99-
json=payload, timeout=60, verify=self.verify)
97+
try:
98+
r = requests.post("%s/create_jobs" % self.api_server,
99+
headers=self.get_headers(),
100+
json=payload, timeout=300, verify=self.verify)
101+
except:
102+
self.console.collect('Failed to connect to API, retrying.', show=True)
103+
time.sleep(3)
104+
continue
100105

101106
if r.status_code == 200:
102107
return

src/job/job.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ def check_container_crashed(self):
286286

287287
def main(self):
288288
self.load_data()
289+
# Date
290+
self.console.collect("Date:\n", show=True)
291+
self.console.execute(['date'], show=True, show_cmd=False)
289292

290293
# Show environment
291294
self.console.collect("Environment:\n", show=True)

src/pyinfraboxutils/ibflask.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ def decorated_function(*args, **kwargs):
186186

187187
job_state = r[0]
188188
if job_state not in ('queued', 'running', 'scheduled'):
189-
logger.warn('job not in an active state')
190189
abort(401, 'Unauthorized')
191190

192191

@@ -213,7 +212,6 @@ def validate_job_token(token):
213212

214213
job_state = r[0]
215214
if job_state not in ('queued', 'running', 'scheduled'):
216-
logger.warn('job not in an active state')
217215
abort(401, 'Unauthorized')
218216

219217

0 commit comments

Comments
 (0)