File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 55import argparse
66import subprocess
77import logging
8+ import time as t
89
910from smartdispatch import utils
1011from smartdispatch .command_manager import CommandManager
@@ -44,10 +45,21 @@ def main():
4445 stdout_filename = os .path .join (args .logs_dir , uid + ".out" )
4546 stderr_filename = os .path .join (args .logs_dir , uid + ".err" )
4647
47- with open (stdout_filename , 'w' ) as stdout_file :
48- with open (stderr_filename , 'w' ) as stderr_file :
49- stdout_file .write ("# " + command + '\n ' )
50- stderr_file .write ("# " + command + '\n ' )
48+ stdout_already_exists = os .path .isfile (stdout_filename )
49+ stderr_already_exists = os .path .isfile (stderr_filename )
50+
51+ with open (stdout_filename , 'a' ) as stdout_file :
52+ with open (stderr_filename , 'a' ) as stderr_file :
53+ if not stdout_already_exists :
54+ stdout_file .write (t .strftime ("## %Y-%m-%d %H:%M:%S ##\n " ))
55+ else :
56+ stdout_file .write ("# " + command + '\n ' )
57+
58+ if not stderr_already_exists :
59+ stderr_file .write (t .strftime ("## %Y-%m-%d %H:%M:%S ##\n " ))
60+ else :
61+ stderr_file .write ("# " + command + '\n ' )
62+
5163 stdout_file .flush ()
5264 stderr_file .flush ()
5365
You can’t perform that action at this time.
0 commit comments