예제 #1
0
 def run(self) -> Model:
     self.validate()
     try:
         dashboard = DashboardDAO.create(self._properties, commit=False)
         dashboard = DashboardDAO.update_charts_owners(dashboard, commit=True)
     except DAOCreateFailedError as ex:
         logger.exception(ex.exception)
         raise DashboardCreateFailedError()
     return dashboard
예제 #2
0
 def run(self) -> Model:
     self.validate()
     try:
         dashboard = DashboardDAO.update(self._model, self._properties, commit=False)
         dashboard = DashboardDAO.update_charts_owners(dashboard, commit=False)
         if self._properties.get("json_metadata"):
             dashboard = DashboardDAO.set_dash_metadata(
                 dashboard,
                 data=json.loads(self._properties.get("json_metadata", "{}")),
                 commit=False,
             )
         db.session.commit()
     except DAOUpdateFailedError as ex:
         logger.exception(ex.exception)
         raise DashboardUpdateFailedError() from ex
     return dashboard