def _verify_stackdriver_dashboard()

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


    def _verify_stackdriver_dashboard(self):
        logging.info("Verifying Stackdriver Dashboard...")
        dashboard_url = None

        try:
            dashboard_url = sd_utils.get_stackdriver_group_url(
                self.project, self.job_name, self.region
            )
        # Raising a general exception (caught in verify_job) since we're unsure
        # of how to proceed
        except Exception as e:
            msg = (
                "Error encountered while trying to determine whether a "
                "Stackdriver dashboard already exists for this job: . "
                "{}".format(e)
            )
            logging.error(msg)
            raise e

        if dashboard_url:
            logging.info(
                "Stackdriver Dashboard exists at {}".format(dashboard_url)
            )
            return True

        elif self.create_resources:
            logging.info("Creating Stackdriver Dashboard...")
            # nothing already exists; we'll create one now
            dashboard_url = sd_utils.create_stackdriver_group(
                self.project, self.job_name, self.region
            )
            if dashboard_url:  # could still be none
                logging.info(
                    "Stackdriver Dashboard created at {}".format(dashboard_url)
                )
                return True
            # reason why dashboard couldn't be created will already be logged
            logging.error("Could not create Stackdriver Dashboard.")
        else:
            logging.info("No Stackdriver Dashboard exists.")
        return False