Exemple #1
0
 def main(self):
     routes = [
         html.link(html.chain(html.span(name), ':', html.code(spec)), spec)
         for spec, name in self.dash.routes
     ]
     page = self.env.get_template('routes.html')
     return page.render(routes=html.div(html.header('Routes', level=4),
                                        html.ul(routes)),
                        state=self.app.state)
Exemple #2
0
    def parameter_link(self, name, param, uid2=None):
        if len(param.shape) == 0:
            size = param.item()
        else:
            size = param.shape

        return ' '.join([
            html.link(name, self.param_subroute(name, uid2)),
            html.code(size)
        ])
Exemple #3
0
    def module_selection(self, model: nn.Module, uid, keys):
        layers = []
        for k, v in list_layers(model):
            layers.append(' '.join(
                [html.link(k, self.module_subroute(k)),
                 html.code(type(v))]))

        return html.div(
            html.header(
                f'Modules of {html.code(".".join(keys))} in {html.code(uid)}',
                level=4), html.ol(layers))
Exemple #4
0
    def show_expriment(n):
        status = data.get(n, {})
        if not nolink:
            link = html.link(n, ref=f'/{base_path}/{queue}/{n}')
        else:
            link = n

        row = f"""
            <tbody>
                <tr>
                    <td>{link}</td>
                    <td>{status.get("lost", 0)}</td>
                    <td>{status.get("failed", 0)}</td>
                    <td>{status.get("agent", 0)}</td>
                    <td>{status.get("runtime_actioned", 0):0.2f}</td>
                </tr>
            </tbody>"""
        return row
Exemple #5
0
    def list_uids(self):
        self.meta = self.storage.meta.load(self.storage.folder)

        # find all the states including best and init
        all_uid = defaultdict(list)
        for i in glob.glob(f'{self.storage.folder}/*.state'):
            filename = i.split('/')[-1][:-6]
            uid = filename.split('_')[-1]
            all_uid[uid].append(filename)

        data = defaultdict(set)
        for uid, args in self.meta.items():
            task = args.pop('task', 'undefined')

            others = all_uid.get(uid, set())
            data[task] = data[task].union(others)
            data[task].add(uid)

        items = []
        for task, uids in data.items():
            items.append(''.join([task, html.ul([html.link(uid, self.subroute(uid)) for uid in uids])]))

        return html.ul(items)
Exemple #6
0
 def list_namespaces(self, queue):
     return html.div(
         html.header(queue, level=4),
         html.ul(
             html.link(n, f'/{self.base_path}/{queue}/{n}')
             for n in self.client.namespaces(queue)))
Exemple #7
0
 def list_queues(self):
     return html.ul(
         html.link(q, f'/{self.base_path}/{q}')
         for q in self.client.queues())
Exemple #8
0
 def list_agents(self, queue, namespace):
     return html.div(
         html.header('Agents', level=4),
         html.ul(
             html.link(q, f'/{self.base_path}/{queue}/{namespace}/{q.uid}') for q in self.client.agents(namespace)))
Exemple #9
0
 def main(self):
     routes = [
         html.link(html.chain(html.span(name), ':', html.code(spec)), spec)
         for spec, name in self.dash.routes
     ]
     return html.div(html.header('Routes', level=4), html.ul(routes))
Exemple #10
0
 def list_namespaces(self, queue=WORK_QUEUE):
     return html.div(
         html.header('Experiments', level=4),
         html.ul(
             html.link(n, f'/{self.base_path}/{n}')
             for n in self.client.namespaces(queue)))