diff --git a/ec2deploy.py b/ec2deploy.py
index cec3311..1c9f7b6 100755
--- a/ec2deploy.py
+++ b/ec2deploy.py
@@ -10,8 +10,8 @@
parser.add_argument('enable_cors')
args = parser.parse_args()
-#comment occurences of AWS_SESSION_TOKEN and session_token
-#if you are not using an AWS Educate Account
+# comment occurences of AWS_SESSION_TOKEN and session_token
+# if you are not using an AWS Educate Account
session = boto3.Session()
access_key = session.get_credentials().access_key
@@ -19,7 +19,7 @@
session_token = session.get_credentials().token
ec2 = session.resource('ec2')
-start_up_script="""#!/usr/bin/env bash
+start_up_script = """#!/usr/bin/env bash
export AWS_ACCESS_KEY_ID='{access_key}'
export AWS_SECRET_ACCESS_KEY='{secret_key}'
export AWS_SESSION_TOKEN='{session_token}'
@@ -54,7 +54,7 @@
print('Instance {} was started. Waiting for output ...'.format(i.instance_id))
-prev_output=''
+prev_output = ''
while True:
time.sleep(10)
o = i.console_output()
@@ -63,16 +63,14 @@
if output != prev_output:
print('...\n'*3)
print(output)
- prev_output=output
+ prev_output = output
if i.state['Name'] == 'terminated':
break
-success_string='Stack {} was successfully deployed'.format(args.stack_name)
+success_string = 'Stack {} was successfully deployed'.format(args.stack_name)
print(('#'*60+'\n')*3)
if success_string in prev_output:
print(success_string)
else:
print('There were some problems. See above output for more details')
-
-
diff --git a/index.html b/index.html
index 6b65aaa..5205b76 100644
--- a/index.html
+++ b/index.html
@@ -149,7 +149,7 @@
Test Results
console.log(userInfo.duration, "seconds of execution time.")
console.log(userInfo,"userInfo")
document.getElementById("responseJSON").value = JSON.stringify(userInfo.ipynb);
- document.getElementById("resultJSON").value = JSON.stringify(userInfo.result);
+ document.getElementById("resultJSON").value = JSON.stringify(userInfo.results,null,'\t');
// pass data to component via problem global object
window.problem = userInfo.ipynb;
diff --git a/main.py b/main.py
index 413f546..055d49f 100644
--- a/main.py
+++ b/main.py
@@ -20,9 +20,6 @@
os.environ['PYTHONPATH'] = os.environ['PYTHONPATH'] + ":" + CURRENT_DIR + ":" + BUILD_DIR + ":" + OVERLAY_DIR
-
-
-
import logging
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
@@ -56,7 +53,6 @@ def save_files_to_temp_dir(files):
def execute_notebook(source):
"""
-
:param source: Jupyter Notebook
:return: Result of the notebook invocation
"""
@@ -115,19 +111,22 @@ def handler(event, context):
attached_files = request_body['files'] if 'files' in request_body else {}
save_files_to_temp_dir(attached_files)
-
-
start = timer()
result = execute_notebook(json.dumps(notebook_source))
result = json.loads(result)
exec_result = return_result_json()
-
+ print(exec_result)
+ print(type(exec_result))
+ if(exec_result and isinstance(exec_result, str)):
+ exec_result_loaded = json.loads(exec_result)
+ else:
+ exec_result_loaded = exec_result
end = timer()
duration = end - start
response = {
"statusCode": 200,
- "body": json.dumps({"duration": duration,"ipynb": result, "result": exec_result}),
+ "body": json.dumps({"duration": duration,"ipynb": result, "result": exec_result, "results":exec_result_loaded}),
"headers": {
'Content-Type': 'application/json',
}
diff --git a/requirements.txt b/requirements.txt
index 4157872..740b9f6 100644
Binary files a/requirements.txt and b/requirements.txt differ