Skip to content

Commit 0e959d0

Browse files
committed
Merge pull request #57 from iron-io/python-fixes
Python fixes
2 parents 197598b + 5fd3b6b commit 0e959d0

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

images/python/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ RUN \
1313
&& apk --no-cache add py-curl \
1414
&& easy_install-2.7 "urlgrabber==3.9.1" \
1515
\
16-
&& easy_install-2.7 "botocore==1.4.1" \
17-
&& easy_install-2.7 "boto3==1.2.6" \
16+
&& easy_install-2.7 "botocore==1.4.17" \
17+
&& easy_install-2.7 "boto3==1.3.1" \
1818
\
1919
&& rm -rf /tmp/*
2020

images/python/bootstrap.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self):
3333
self.memory_limit_in_mb = int(getTASK_MAXRAM() / 1024 / 1024)
3434

3535
def get_remaining_time_in_millis(self):
36-
remaining = plannedEnd - time.time()
36+
remaining = plannedEnd - int(time.time())
3737
if remaining < 0:
3838
remaining = 0
3939
return remaining * 1000
@@ -112,8 +112,10 @@ def getPAYLOAD_FILE():
112112

113113

114114
def getTASK_TIMEOUT():
115-
return os.environ.get('TASK_TIMEOUT') or 3600
116-
115+
try:
116+
return int(os.environ.get('TASK_TIMEOUT'))
117+
except ValueError:
118+
return 3600
117119

118120
def getTASK_MAXRAM():
119121
# IronWorker uses MAXMEM, Hybrid uses MAXRAM.
@@ -190,7 +192,7 @@ def filter(self, record):
190192
}
191193
logging.config.dictConfig(loggingConfig)
192194

193-
plannedEnd = time.time() + getTASK_TIMEOUT()
195+
plannedEnd = int(time.time()) + getTASK_TIMEOUT()
194196

195197
debugging and print ('os.environ = ', os.environ)
196198
debugging and print ('/mnt content = ', os.listdir("/mnt"))

test-suite/tests/python/test-context-values/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
def run(event, context):
66
print("Function name is set:", not (context.function_name is None))
77
print("Function version is set:", not (context.function_version is None))
8-
print("Memory limit in MB (grater or equal than 100):", context.memory_limit_in_mb > 100)
8+
print("Memory limit in MB is positive:", context.memory_limit_in_mb > 0)
99
print("AWS request ID is set:", not (context.aws_request_id is None))
1010

1111
remaining1 = context.get_remaining_time_in_millis()

0 commit comments

Comments
 (0)