Ejemplo n.º 1
0
    def get_context_data(self, **kw):
        ctx = super().get_context_data(**kw)

        if self.fake:
            s = None
        else:
            s = WorkSession.from_session(self.request)

        if s is None:
            s = WorkSession.generic_status_info(self.request)
            fake = True
        else:
            if not s.readonly:
                # If we are updating the session, update the dsmap configuration
                s.info.update_models()
                s.info.update_runs()
                s.sync()
            s = s.to_jsonable()
            fake = False

        ctx["session"] = s
        if fake:
            ctx["title"] = _("Model monitor")
        else:
            ctx.update(
                title=_("Monitor selection"),
                nav_prev={
                    "url": reverse("index"),
                    "label": _("Main page"),
                },
                nav_next={
                    "url": reverse("products_list"),
                    "label": _("Products"),
                }
            )
        return ctx
Ejemplo n.º 2
0
 def handle(self, sessname, **kw):
     ws = WorkSession.load(sessname, True)
     prods = pmodels.Products(ws)
     print("Product list:")
     writer = csv.writer(sys.stdout)
     writer.writerow(["Basename", "Run", "Model", "Var", "Validity", "Day", "Changed"])
     for p in prods.list():
         writer.writerow([
             p.basename,
             p.run,
             p.model,
             p.var,
             p.validity,
             p.day,
             p.changed])