def _run_docker_container()

in cli/src/klio_cli/commands/job/run.py [0:0]


    def _run_docker_container(self, runflags):
        container = self._docker_client.containers.run(**runflags)

        if self.run_job_config.direct_runner:
            atexit.register(self._try_container_kill, container)

        # TODO: container.logs(stream=True) redirects stderr to stdout.
        #       We should use appropriate streams so it's obvious to the use.
        #       (@jpvelez)
        for line in container.logs(stream=True):
            self._docker_logger.info(line.decode("utf-8").strip("\n"))

        exit_status = container.wait()["StatusCode"]

        if exit_status == 0 and not self.run_job_config.direct_runner:
            dashboard_name = sd_utils.DASHBOARD_NAME_TPL.format(
                job_name=self.klio_config.job_name,
                region=self.klio_config.pipeline_options.region,
            )
            base_err_msg = (
                "Could not find a Stackdriver dashboard for job '%s' that "
                "matched the name %s"
                % (self.klio_config.job_name, dashboard_name)
            )

            try:
                dashboard_url = sd_utils.get_stackdriver_group_url(
                    self.klio_config.pipeline_options.project,
                    self.klio_config.job_name,
                    self.klio_config.pipeline_options.region,
                )
            except Exception as e:
                logging.warning("%s: %s" % (base_err_msg, e))
            else:
                if dashboard_url:
                    logging.info(
                        "View the job's dashboard on Stackdriver: %s"
                        % dashboard_url
                    )
                else:
                    logging.warning(base_err_msg)

        return exit_status