示例#1
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'])
示例#2
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)
示例#3
0
 def test_monitor_with_dumping(self):
     dump_path = tempfile.mktemp()
     session_id = self._submit()
     status = common.monitor_sessions(session_id=session_id,
                                      poll_interval=0.1,
                                      port=self.port,
                                      status_dump_path=dump_path)
     self.assert_session_finished(status)
     self.assertTrue(os.path.exists(dump_path))
     os.remove(dump_path)
示例#4
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')
示例#5
0
 def test_monitor_all(self):
     session_id1 = self._submit()
     session_id2 = self._submit()
     status = common.monitor_sessions(port=self.port, poll_interval=0.1)
     self.assert_sessions_finished(status, session_id1, session_id2)
示例#6
0
 def test_monitor(self):
     session_id = self._submit()
     status = common.monitor_sessions(session_id,
                                      port=self.port,
                                      poll_interval=0.1)
     self.assert_session_finished(status)