コード例 #1
0
    def _get_result(self):
        """
        Reads all of the images in /output/ and converts to upload session
        """
        base_dir = "/output/"

        try:
            with cleanup(
                self._client.containers.run(
                    image=self._io_image,
                    volumes={
                        self._input_volume: {"bind": base_dir, "mode": "ro"}
                    },
                    detach=True,
                    tty=True,
                    **self._run_kwargs,
                )
            ) as reader:
                self._copy_output_files(
                    container=reader, base_dir=Path(base_dir)
                )
        except Exception as exc:
            raise RuntimeError(str(exc))

        return {}
コード例 #2
0
ファイル: models.py プロジェクト: comic/comic-django
    def _get_result(self):
        """
        Reads all of the images in /output/ and converts to upload session
        """
        base_dir = "/output/"

        try:
            with cleanup(
                self._client.containers.run(
                    image=self._io_image,
                    volumes={
                        self._input_volume: {"bind": base_dir, "mode": "ro"}
                    },
                    name=f"{self._job_label}-reader",
                    detach=True,
                    tty=True,
                    labels=self._labels,
                    **self._run_kwargs,
                )
            ) as reader:
                self._copy_output_files(
                    container=reader, base_dir=Path(base_dir)
                )
        except Exception as exc:
            raise RuntimeError(str(exc))

        return {}
コード例 #3
0
    def _get_result(self):
        """
        Reads all of the images in /output/ and converts to upload session
        """

        try:
            with cleanup(
                    self._client.containers.run(
                        image=self._io_image,
                        volumes={
                            self._output_volume: {
                                "bind": "/output/",
                                "mode": "ro"
                            }
                        },
                        name=f"{self._job_label}-reader",
                        detach=True,
                        tty=True,
                        labels=self._labels,
                        **self._run_kwargs,
                    )) as reader:
                self._copy_output_files(container=reader,
                                        base_dir=Path(self.output_images_dir))
        except Exception as exc:
            raise RuntimeError(str(exc))

        return super()._get_result()