Write to User Data File Error for Multi-day Parallel Job

Get following error on some jobs when attempting to write to a user data file when running a multi-day parallel job.

Traceback (most recent call last):
File "run_simulation.py", line 558, in
main(sys.argv[1:])
File "run_simulation.py", line 532, in main
results = simulator()
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1518633256423/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/engine.py", line 580, in call
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1518633256423/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/engine.py", line 809, in simulate
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1518633256423/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/engine.py", line 2245, in end_simulation_day
File "job/CQ9144e012e0274a06b8866f9fba140ddc.py", line 22, in on_strategy_finish
service.write_file('wfile_test', log, end='\n')
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1518633256423/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/util.py", line 237, in write_file
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1518633256423/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/util.py", line 157, in get_writable_file_handle
File "/opt/anaconda/lib/python2.7/shutil.py", line 119, in copy
copyfile(src, dst)
File "/opt/anaconda/lib/python2.7/shutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: 'job/user_data/wfile_test'

Comments

  • ptunneyptunney Posts: 246

    You are probably having a problem with multiple parallel runs trying to write to the same file and stomping on each other..
    Try creating a unique file for each backtest date using the date in the filename
    service.time_to_string(event.timestamp, '%Y-%m-%d')

Sign In or Register to comment.