-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Code editor for code parameters (#7)
* Added papermill custom engine to reuse it for notebook execution * update file path to absolute instead of relative * add ability for getting customization file from result * Implemented logic to use a separate papermill notebook client for each notebook * Implemented async_execute for papermill engine * Added EngineBusyError * Configured compose.yml to build j-sp image instead of pulling from repository * Optimised Dockerfile * Removed --build flag fro running compose * j-sp generates cookies with `engine_user_id` field to identify user for creating unique python engine. * add example of notebook * update readme with updates of viewer --------- Co-authored-by: nikita.smirnov <[email protected]>
- Loading branch information
1 parent
9ab041c
commit 5f9ebe8
Showing
6 changed files
with
180 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": { | ||
"tags": [ | ||
"parameters" | ||
] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"output_path='output.jsonl'\n", | ||
"lambda_pycode = \"\"\"lambda a:a['weight'] < 300\"\"\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"0 5 50\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import json\n", | ||
"import random\n", | ||
"from datetime import datetime\n", | ||
"amount = 100\n", | ||
"\n", | ||
"displayTable = [\n", | ||
" ['bid order', 'bid rate', 'bid qty', 'ask order', 'ask rate', 'ask qty'],\n", | ||
" ['424', '0.61500000', '101', '', '', ''],\n", | ||
" ['424', '0.61500000', '101', '', '', ''],\n", | ||
"]\n", | ||
"\n", | ||
"timestamp = 1725539650\n", | ||
"amount = 200\n", | ||
"pos = 0\n", | ||
"conver = 1000000000\n", | ||
"\n", | ||
"testArr = []\n", | ||
"\n", | ||
"while pos < amount:\n", | ||
" timestamp_in_nano = timestamp*1000000000\n", | ||
" weight = random.randrange(1, 1000)\n", | ||
" timest_obj = datetime.fromtimestamp(timestamp)\n", | ||
" testArr.append({ '#display-timestamp': timestamp_in_nano, '#display-name': str(pos) + ' ' + str(timest_obj), '#display-table': displayTable, 'weight': weight})\n", | ||
" pos = pos + 1\n", | ||
" timestamp += random.randrange(1, 100)\n", | ||
"\n", | ||
"filtered = list(filter(eval(lambda_pycode), testArr))\n", | ||
"\n", | ||
"with open(output_path, \"w\") as out_file:\n", | ||
" for orig_order in filtered:\n", | ||
" json.dump(orig_order, out_file)\n", | ||
" out_file.write('\\n')" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.