Skip to content

Commit

Permalink
BUGFIX: Making filenames uniques to avoid parallel workers overwritti…
Browse files Browse the repository at this point in the history
…ng/deleting files
  • Loading branch information
vikashplus committed Sep 28, 2023
1 parent 84b8c21 commit c16bc11
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions robohive/envs/myo/myodm/myodm_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from robohive.logger.reference_motion import ReferenceMotion
from robohive.utils.quat_math import quat2euler, euler2quat, quatDiff2Vel, mat2quat
import numpy as np
import os
import os, time
import collections
from robohive.envs.myo.base_v0 import BaseV0

Expand Down Expand Up @@ -39,12 +39,13 @@ def __init__(self, object_name, model_path, obsd_model_path=None, seed=None, **k

curr_dir = os.path.dirname(os.path.abspath(__file__))
self.object_name = object_name
time_stamp = str(time.time())

# Process model_path to import the right object
with open(curr_dir+model_path, 'r') as file:
processed_xml = file.read()
processed_xml = processed_xml.replace('OBJECT_NAME', object_name)
processed_model_path = curr_dir+model_path[:-4]+"_processed.xml"
processed_model_path = curr_dir+model_path[:-4]+time_stamp+"_processed.xml"
with open(processed_model_path, 'w') as file:
file.write(processed_xml)
# Process obsd_model_path to import the right object
Expand All @@ -54,7 +55,7 @@ def __init__(self, object_name, model_path, obsd_model_path=None, seed=None, **k
with open(curr_dir+obsd_model_path, 'r') as file:
processed_xml = file.read()
processed_xml = processed_xml.replace('OBJECT_NAME', object_name)
processed_obsd_model_path = curr_dir+model_path[:-4]+"_processed.xml"
processed_obsd_model_path = curr_dir+model_path[:-4]+time_stamp+"_processed.xml"
with open(processed_obsd_model_path, 'w') as file:
file.write(processed_xml)
else:
Expand Down

0 comments on commit c16bc11

Please sign in to comment.