Exemplo n.º 1
0
 def _submit(self):
     pg = [
         {
             "oid": "A",
             "type": "plain",
             "storage": Categories.MEMORY
         },
         {
             "oid": "B",
             "type": "app",
             "app": "dlg.apps.simple.SleepApp",
             "inputs": ["A"],
             "outputs": ["C"]
         },
         {
             "oid": "C",
             "type": "plain",
             "storage": Categories.MEMORY
         },
     ]
     pg = add_test_reprodata(pg)
     for drop in pg:
         drop['node'] = '127.0.0.1'
         drop['island'] = '127.0.0.1'
     return common.submit(pg, '127.0.0.1', self.port)
Exemplo n.º 2
0
def submit(pg, opts):
    from dlg.deploy import common
    session_id = common.submit(pg,
                               host=opts.host,
                               port=opts.port,
                               skip_deploy=opts.skip_deploy,
                               session_id=opts.session_id)
    if opts.wait:
        common.monitor_sessions(session_id,
                                host=opts.host,
                                port=opts.port,
                                poll_interval=opts.poll_interval)

    if opts.reproducibility:
        dump = _setup_output(opts)
        common.monitor_sessions_repro(session_id,
                                      host=opts.host,
                                      port=opts.port,
                                      poll_interval=opts.poll_interval)
        repro_data = common.fetch_reproducibility(
            session_id,
            host=opts.host,
            port=opts.port,
            poll_interval=opts.poll_interval)
        dump(repro_data['graph'])
Exemplo n.º 3
0
    def _task():
        dump_path = None
        if opts.dump:
            dump_path = os.path.join(opts.log_dir, "status-monitoring.json")
        if submit:
            session_id = common.submit(physical_graph,
                                       host=host,
                                       port=port,
                                       session_id=opts.ssid)
        else:
            session_id = opts.ssid

        LOGGER.info(
            f"Start monitoring session(s) '{session_id}' on host {host}:{port}"
        )
        while True:
            try:
                common.monitor_sessions(session_id,
                                        host=host,
                                        port=port,
                                        status_dump_path=dump_path)
                break
            except:
                LOGGER.exception(
                    f"Monitoring {host}:{port} failed, restarting it")
                time.sleep(5)
Exemplo n.º 4
0
 def submit_pg(self):
     """
     There is a semi-dynamic element to fetching the IPs of Node(s) to deploy to.
     Hence, launching the chart and initiating graph execution have been de-coupled.
     """
     if not self._k8s_access:
         raise RuntimeError("Cannot access k8s")
     # TODO: Check all nodes are operational first.
     pg_data = json.loads(self._physical_graph_file)
     # TODO: Add dumping to log-dir
     submit(
         pg_data,
         self._submission_endpoint,
         port=NODE_DEFAULT_REST_PORT,
         skip_deploy=False,
     )
Exemplo n.º 5
0
 def submit_pgt(self):
     """
     There is a semi-dynamic element to fetching the IPs of Node(s) to deploy to.
     Hence, launching the chart and initiating graph execution have been de-coupled.
     """
     if not self._k8s_access:
         raise RuntimeError("Cannot access k8s")
     # TODO: Check all nodes are operational first.
     pgt_data = json.loads(self._physical_graph_file)
     node_ips = [x["ip"] for x in self._pod_details.values()]
     node_ips.remove(self._pod_details["master"]["ip"])
     node_ips = [self._pod_details["master"]["ip"]] + node_ips
     # node_ips = ['127.0.0.1']
     physical_graph = pg_generator.resource_map(pgt_data, node_ips, co_host_dim=True)
     # TODO: Add dumping to log-dir
     submit(
         physical_graph,
         self._submission_endpoint,
         port=NODE_DEFAULT_REST_PORT,
         skip_deploy=False,
     )
Exemplo n.º 6
0
def run_processing_block(processing_block,
                         status_callback,
                         host='127.0.0.1',
                         port=constants.ISLAND_DEFAULT_REST_PORT,
                         zero_cost_run=False):
    """Runs a ProcessingBlock to completion under daliuge"""

    session_id = 'pb_%s' % processing_block.pb_id
    logical_graph = _get_lg(processing_block.workflow['id'],
                            processing_block.workflow['version'])

    status_callback('preparing')
    nodes = client.CompositeManagerClient(host, port, timeout=None).nodes()
    physical_graph = _create_pg(logical_graph,
                                processing_block,
                                nodes,
                                host,
                                zero_cost_run=zero_cost_run)
    common.submit(physical_graph, host=host, port=port, session_id=session_id)
    status_callback('running')
    common.monitor_sessions(session_id=session_id, host=host, port=port)
    status_callback('finished')