From c6799fb4dbb4f6809291d9666b0c3e8b263b0b8e Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Wed, 5 Jan 2022 11:53:32 -0500 Subject: [PATCH 1/6] don't create and mount shared workspace --- src/roswire/app/app.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/roswire/app/app.py b/src/roswire/app/app.py index d1b4191b..31f4ec0c 100644 --- a/src/roswire/app/app.py +++ b/src/roswire/app/app.py @@ -144,11 +144,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,10 +151,7 @@ def launch( name=name, entrypoint="/bin/sh -c", environment=environment, - volumes={ - host_workspace: {"bind": "/.roswire", "mode": "rw"}, - **volumes, - }, + volumes=volumes, ports=ports, ) From 0d9383c33c5a6562468af737644795b2342676cb Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Wed, 5 Jan 2022 12:03:10 -0500 Subject: [PATCH 2/6] removed _host_workspace from AppInstance --- src/roswire/app/app.py | 1 - src/roswire/app/instance.py | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/src/roswire/app/app.py b/src/roswire/app/app.py index 31f4ec0c..e5481bb3 100644 --- a/src/roswire/app/app.py +++ b/src/roswire/app/app.py @@ -158,7 +158,6 @@ def launch( instance = AppInstance( app=self, dockerblade=container, - host_workspace=host_workspace, ) return instance diff --git a/src/roswire/app/instance.py b/src/roswire/app/instance.py index b251d87f..ff139174 100644 --- a/src/roswire/app/instance.py +++ b/src/roswire/app/instance.py @@ -38,9 +38,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 +48,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 +141,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, From 021118528a3e0166e4861fbd6bc4b85a36aa5dda Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Wed, 5 Jan 2022 12:23:33 -0500 Subject: [PATCH 3/6] removed shared workspace from ROS1 --- src/roswire/ros1/ros1.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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 From de76ec81f8ce29e7663674a2f3fc16f85b87310b Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Wed, 5 Jan 2022 12:29:24 -0500 Subject: [PATCH 4/6] removed unused imports --- src/roswire/app/app.py | 2 -- src/roswire/app/instance.py | 3 --- 2 files changed, 5 deletions(-) diff --git a/src/roswire/app/app.py b/src/roswire/app/app.py index e5481bb3..718f9d48 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 diff --git a/src/roswire/app/instance.py b/src/roswire/app/instance.py index ff139174..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 From 7a73c1b13ac82fc1c3c92c6e5c32791176b323ce Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Wed, 5 Jan 2022 12:53:23 -0500 Subject: [PATCH 5/6] removed bad keyword argument --- src/roswire/app/app.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/roswire/app/app.py b/src/roswire/app/app.py index 718f9d48..378209a5 100644 --- a/src/roswire/app/app.py +++ b/src/roswire/app/app.py @@ -191,6 +191,5 @@ def attach( instance = AppInstance( app=self, dockerblade=container, - host_workspace=None ) return instance From 99c563130fb915d02f95713ef248c9352af5b47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20D=C3=BCrschmid?= Date: Tue, 28 Nov 2023 13:33:15 -0500 Subject: [PATCH 6/6] Fix ContainerFileNotFound --- src/roswire/ros1/launch/reader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: