Spaces:
Runtime error
Runtime error
Yixin Liu
commited on
Commit
·
c134b6a
1
Parent(s):
564624d
upload
Browse files- main.py +3 -0
- parse_code.py +2 -2
main.py
CHANGED
|
@@ -78,6 +78,9 @@ memory_rate_max={memory_max_utility}
|
|
| 78 |
constrain_total={constrain_total}
|
| 79 |
constrain_mine={"true" if constrain_mine else "false"}
|
| 80 |
constrain_rate={"true" if constrain_rate else "false"}
|
|
|
|
|
|
|
|
|
|
| 81 |
"""
|
| 82 |
|
| 83 |
|
|
|
|
| 78 |
constrain_total={constrain_total}
|
| 79 |
constrain_mine={"true" if constrain_mine else "false"}
|
| 80 |
constrain_rate={"true" if constrain_rate else "false"}
|
| 81 |
+
date_stamp=`date '+%Y-%m-%d-%H'`
|
| 82 |
+
log_dir="logs/$exp_name/$date_stamp"
|
| 83 |
+
mkdir -p $log_dir
|
| 84 |
"""
|
| 85 |
|
| 86 |
|
parse_code.py
CHANGED
|
@@ -44,8 +44,8 @@ def parse_base_code(contents, debug = False):
|
|
| 44 |
span_remove_the_first_part = span[span.index("\n"):]
|
| 45 |
if not debug:
|
| 46 |
spans_with_type_added_device_control.append((f"\n\ncommand=\"\"\"{span_remove_the_first_part}\"\"\"\n", type_))
|
| 47 |
-
run_command = "eval $command"
|
| 48 |
-
run_command += " &"
|
| 49 |
run_command += "\n\n\n"
|
| 50 |
spans_with_type_added_device_control.append((run_command, type_))
|
| 51 |
else:
|
|
|
|
| 44 |
span_remove_the_first_part = span[span.index("\n"):]
|
| 45 |
if not debug:
|
| 46 |
spans_with_type_added_device_control.append((f"\n\ncommand=\"\"\"{span_remove_the_first_part}\"\"\"\n", type_))
|
| 47 |
+
run_command = "eval nohup $command"
|
| 48 |
+
run_command += " > $log_dir/$RANDOM$RANDOM.log 2>&1 &"
|
| 49 |
run_command += "\n\n\n"
|
| 50 |
spans_with_type_added_device_control.append((run_command, type_))
|
| 51 |
else:
|