示例#1
0
 def _fill_parts(self):
     pkg_man = self._specs['pkg_manager']
     for item in self._specs['instructions']:
         instruction, params = item
         if instruction in self._implementations.keys():
             impl = self._implementations[instruction]
             if impl in _installation_implementations.values():
                 interface = impl(pkg_manager=pkg_man, **params)
                 if interface.env:
                     _this_env = interface.render_env()
                     if _this_env is not None:
                         self._environment.update(**_this_env)
                 if interface.run:
                     self._post.append(interface.render_run())
             else:
                 if instruction == 'install':
                     impl(params, pkg_manager=pkg_man)
                 else:
                     impl(params)
         else:
             raise ValueError(
                 "instruction not understood: '{}'".format(instruction))
     if not self._runscript:
         self._runscript.append(NEURODOCKER_ENTRYPOINT)
     self._parts_filled = True
示例#2
0
 def _fill_parts(self):
     pkg_man = self._specs['pkg_manager']
     for item in self._specs['instructions']:
         instruction, params = item
         if instruction in self._implementations.keys():
             impl = self._implementations[instruction]
             if impl in _installation_implementations.values():
                 try:
                     interface = impl(pkg_manager=pkg_man, **params)
                 except Exception as exc:
                     logger.error("Failed to instantiate {}: {}".format(
                         impl, exc))
                     raise
                 if interface.env:
                     _this_env = interface.render_env()
                     if _this_env is not None:
                         self._environment.extend(_this_env.items())
                 if interface.run:
                     self._post.append(interface.render_run())
             else:
                 if instruction == 'install':
                     impl(params, pkg_manager=pkg_man)
                 else:
                     impl(params)
         else:
             raise ValueError(
                 "instruction not understood: '{}'".format(instruction))
     if not self._runscript:
         self._runscript = NEURODOCKER_ENTRYPOINT
     self._parts_filled = True
示例#3
0
 def _ispecs_to_dockerfile_str(self):
     pkg_man = self._specs['pkg_manager']
     for item in self._specs['instructions']:
         instruction, params = item
         if instruction in self._implementations.keys():
             impl = self._implementations[instruction]
             if impl in _installation_implementations.values():
                 interface = impl(pkg_manager=pkg_man, **params)
                 yield _DockerfileInterfaceFormatter(interface).render()
             else:
                 if instruction == 'install':
                     yield impl(params, pkg_manager=pkg_man)
                 else:
                     yield impl(params)
         else:
             raise ValueError(
                 "instruction not understood: '{}'".format(instruction))
示例#4
0
 def _ispecs_to_dockerfile_str(self):
     pkg_man = self._specs["pkg_manager"]
     for item in self._specs["instructions"]:
         instruction, params = item
         if instruction in self._implementations.keys():
             impl = self._implementations[instruction]
             if impl in _installation_implementations.values():
                 try:
                     interface = impl(pkg_manager=pkg_man, **params)
                 except Exception as exc:
                     logger.error("Failed to instantiate {}: {}".format(impl, exc))
                     raise
                 yield _DockerfileInterfaceFormatter(interface).render()
             else:
                 if instruction == "install":
                     yield impl(params, pkg_manager=pkg_man)
                 else:
                     yield impl(params)
         else:
             raise ValueError("instruction not understood: '{}'".format(instruction))