def submit(self): """ Page to submit the model un """ model_run = None try: model_run = \ self._model_run_service.get_model_being_created_with_non_default_parameter_values(self.current_user) except NoResultFound: helpers.error_flash(u"You must create a model run before submitting the model run") redirect(url(controller='model_run', action='create')) if not request.POST: self._user_service.set_current_model_run_creation_action(self.current_user, "submit") summmary_helper = SummaryControllerHelper(model_run_service=self._model_run_service) summmary_helper.add_summary_fields_to_context(model_run, c, self.current_user) else: self._model_run_controller_helper.check_user_quota(self.current_user) if request.params.getone('submit') == u'Submit': status, message = self._model_run_service.submit_model_run(self.current_user) if status.name == constants.MODEL_RUN_STATUS_SUBMITTED: helpers.success_flash(message) else: helpers.error_flash(message) redirect(url(controller='model_run', action='index')) else: redirect(url(controller='model_run', action='output')) return render('model_run/submit.html')
def summary(self, id): """ Controller providing a detailed summary of a single model run :param id: the id of the model run to display :return: Rendered summary page of requested model run """ c.user = self.current_user model_run = self._model_run_service.get_model_by_id(self.current_user, id) summary_helper = SummaryControllerHelper(model_run_service=self._model_run_service) summary_helper.add_summary_fields_to_context(model_run, c, self.current_user) c.user_has_model_run_being_created = \ self._model_run_service.get_user_has_model_run_being_created(self.current_user) # does the model belong to this user. Not to be used for security but for display purposes c.is_users_model = (c.user.id == model_run.user.id) # path to workbench c.workbench_path = config["workbench_path_template"].format(model_run_id=model_run.id) return render("model_run/summary.html")