diff --git a/src/roswire/app/app.py b/src/roswire/app/app.py index d1b4191b..378209a5 100644 --- a/src/roswire/app/app.py +++ b/src/roswire/app/app.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- __all__ = ("App",) -import os -import tempfile import typing from typing import Any, Mapping, Optional, Sequence @@ -144,11 +142,6 @@ def launch( environment = dict(environment) if environment else {} volumes = dict(volumes) if volumes else {} - # generate a temporary shared directory - dir_containers = os.path.join(self._roswire.workspace, "containers") - os.makedirs(dir_containers, exist_ok=True) - host_workspace = tempfile.mkdtemp(dir=dir_containers) - container = dockerblade.provision( image=self.image, command="/bin/sh", @@ -156,17 +149,13 @@ def launch( name=name, entrypoint="/bin/sh -c", environment=environment, - volumes={ - host_workspace: {"bind": "/.roswire", "mode": "rw"}, - **volumes, - }, + volumes=volumes, ports=ports, ) instance = AppInstance( app=self, dockerblade=container, - host_workspace=host_workspace, ) return instance @@ -202,6 +191,5 @@ def attach( instance = AppInstance( app=self, dockerblade=container, - host_workspace=None ) return instance diff --git a/src/roswire/app/instance.py b/src/roswire/app/instance.py index b251d87f..a05fe22e 100644 --- a/src/roswire/app/instance.py +++ b/src/roswire/app/instance.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- __all__ = ("AppInstance",) -import os -import shutil import typing from types import TracebackType from typing import Optional, Type @@ -10,7 +8,6 @@ import attr import dockerblade from docker.models.images import Image as DockerImage -from loguru import logger from ..common import TypeDatabase from ..common.catkin import CatkinInterface, CatkinMake, CatkinTools @@ -38,9 +35,6 @@ class AppInstance: Provides access to a bash shell for this container. files: dockerblade.files.FileSystem Provides access to the filesystem for this container. - _host_workspace: str, optional - The absolute path to the shared directory, if any, for this container's - workspace on the host machine. _dockerblade: dockerblade.container.Container Provides access to the underlying Docker container. """ @@ -51,7 +45,6 @@ class AppInstance: files: dockerblade.files.FileSystem = attr.ib( repr=False, init=False, eq=False ) - _host_workspace: Optional[str] = attr.ib(repr=False, default=None) def __attrs_post_init__(self) -> None: dockerblade = self._dockerblade @@ -145,12 +138,6 @@ def close(self) -> None: """Closes this application instance and destroys all resources.""" self._dockerblade.remove() - workspace = self._host_workspace - if workspace and os.path.exists(workspace): - logger.debug(f"destroying app instance directory: {workspace}") - shutil.rmtree(workspace) - logger.debug(f"destroyed app instance directory: {workspace}") - def persist( self, repo: Optional[str] = None, diff --git a/src/roswire/ros1/launch/reader.py b/src/roswire/ros1/launch/reader.py index 67503e9f..8052de1d 100644 --- a/src/roswire/ros1/launch/reader.py +++ b/src/roswire/ros1/launch/reader.py @@ -233,7 +233,10 @@ def _load_param_tag( if val is not None: value = convert_str_to_type(val, typ) if textfile is not None: - value = self._files.read(textfile) + try: + value = self._files.read(textfile) + except dockerblade.exceptions.ContainerFileNotFound: + value = '' #TODO: FIX ME if binfile is not None: value = self._files.read(binfile, binary=True) if command is not None: diff --git a/src/roswire/ros1/ros1.py b/src/roswire/ros1/ros1.py index 42d4c1f2..f37cc0a6 100644 --- a/src/roswire/ros1/ros1.py +++ b/src/roswire/ros1/ros1.py @@ -66,14 +66,14 @@ class ROS1: @classmethod def for_app_instance(cls, instance: "AppInstance", port: int = 11311) -> "ROS1": - return ROS1(description=instance.app.description, - shell=instance.shell, - files=instance.files, - ws_host=instance._host_workspace, - ip_address=instance.ip_address, - instance=instance, - port=port, - ) + return ROS1( + description=instance.app.description, + shell=instance.shell, + files=instance.files, + ip_address=instance.ip_address, + instance=instance, + port=port, + ) def __init__( self, @@ -81,7 +81,6 @@ def __init__( description: "AppDescription", shell: dockerblade.Shell, files: dockerblade.FileSystem, - ws_host: Optional[str], ip_address: str, port: int = 11311, ) -> None: @@ -89,7 +88,7 @@ def __init__( self.__description = description self.__shell = shell self.__files = files - self.__ws_host = ws_host + self.__ws_host = None assert port > 1023 self.__port = port self.__ip_address = ip_address