|
|
|
|
|
|
container. |
|
|
|
""" |
|
|
|
# Navigate in docker path and find env_path and copy it. |
|
|
|
for f in glob.glob('/{docker_target_name}/*'.format( |
|
|
|
docker_target_name=docker_target_name)): |
|
|
|
if env_path in f: |
|
|
|
try: |
|
|
|
b = os.path.basename(f) |
|
|
|
if os.path.isdir(f): |
|
|
|
shutil.copytree(f, |
|
|
|
'/ml-agents/{b}'.format(b=b)) |
|
|
|
else: |
|
|
|
src_f = '/{docker_target_name}/{b}'.format( |
|
|
|
docker_target_name=docker_target_name, b=b) |
|
|
|
dst_f = '/ml-agents/{b}'.format(b=b) |
|
|
|
shutil.copyfile(src_f, dst_f) |
|
|
|
os.chmod(dst_f, 0o775) # Make executable |
|
|
|
except Exception as e: |
|
|
|
self.logger.info(e) |
|
|
|
env_path = '/ml-agents/{env_name}'.format(env_name=env_path) |
|
|
|
env_path = self._prepare_for_docker_run(docker_target_name, |
|
|
|
env_path) |
|
|
|
if curriculum_folder is not None: |
|
|
|
self.curriculum_folder = \ |
|
|
|
'/{docker_target_name}/{curriculum_folder}'.format( |
|
|
|
|
|
|
'curriculum file has the same ' |
|
|
|
'name as the Brain ' |
|
|
|
'whose curriculum it defines.') |
|
|
|
|
|
|
|
def _prepare_for_docker_run(self, docker_target_name, env_path): |
|
|
|
for f in glob.glob('/{docker_target_name}/*'.format( |
|
|
|
docker_target_name=docker_target_name)): |
|
|
|
if env_path in f: |
|
|
|
try: |
|
|
|
b = os.path.basename(f) |
|
|
|
if os.path.isdir(f): |
|
|
|
shutil.copytree(f, |
|
|
|
'/ml-agents/{b}'.format(b=b)) |
|
|
|
else: |
|
|
|
src_f = '/{docker_target_name}/{b}'.format( |
|
|
|
docker_target_name=docker_target_name, b=b) |
|
|
|
dst_f = '/ml-agents/{b}'.format(b=b) |
|
|
|
shutil.copyfile(src_f, dst_f) |
|
|
|
os.chmod(dst_f, 0o775) # Make executable |
|
|
|
except Exception as e: |
|
|
|
self.logger.info(e) |
|
|
|
env_path = '/ml-agents/{env_name}'.format(env_name=env_path) |
|
|
|
return env_path |
|
|
|
|
|
|
|
def _get_measure_vals(self): |
|
|
|
if self.meta_curriculum: |
|
|
|