Beispiel #1
0
def submit_zapp(zapp):
    """Submits one ZApp for execution."""
    exec_api = ZoeExecutionsAPI(zoe_url(), zoe_user(), zoe_pass())
    ret = exec_api.start('boinc-loader', zapp)
    print(
        "Application scheduled successfully with ID {}, use the exec-get command to check its status"
        .format(ret))
Beispiel #2
0
def exec_start_cmd(args):
    """Submit an execution."""
    app_descr = json.load(args.jsonfile)
    app_validate(app_descr)
    exec_api = ZoeExecutionsAPI(utils.zoe_url(), utils.zoe_user(), utils.zoe_pass())
    ret = exec_api.start(args.name, app_descr)
    print("Application scheduled successfully with ID {}, use the exec-get command to check its status".format(ret))
class Test:
    def __init__(self, user, pwd, url, name, zapp):
        self.user = user
        self.pwd = pwd
        self.url = url
        self.name = name
        try:
            with open(zapp, 'r') as infile:
                self.zapp = json.load(infile)
        except:
            exit("Unable to load zapp file.")
        self.exec_api = ZoeExecutionsAPI(self.url, self.user, self.pwd)
        self.service_api = ZoeServiceAPI(self.url, self.user, self.pwd)

    def start_exec(self):
        exec_id = self.exec_api.start(self.name, self.zapp)
        return exec_id

    def get_services_id(self, exec_id):
        services = self.exec_api.get(exec_id)
        return services['services']

    def get_submit_service(self, exec_id):
        while len(self.get_services_id(exec_id)) < 4:
            print('waiting')
            time.sleep(0.5)
        for service_id in self.get_services_id(exec_id):
            srv = self.service_api.get(service_id)
            if re.search('submit', srv['name']):
                return srv['id']

    def is_running(self, exec_id):
        return self.exec_api.get(exec_id)['status'] == 'running'

    def run_test(self):
        ts = time.time()
        exec_id = self.start_exec()
        outfilename = './logs/{}'.format(exec_id)
        submit_id = self.get_submit_service(exec_id)
        while not self.is_running(exec_id):
            time.sleep(0.5)
        te = time.time()
        with open(outfilename, 'w') as out:
            out.write("PerfMeasure: Scheduling time: {}".format(te - ts))
            for line in self.service_api.get_logs(submit_id):
                out.write("{}\n".format(line))
        self.exec_api.terminate(exec_id)
        print('Terminated {}'.format(exec_id))
Beispiel #4
0
def exec_start_cmd(auth, args):
    """Submit an execution."""
    app_descr = json.load(args.jsonfile)
    exec_api = ZoeExecutionsAPI(auth['url'], auth['user'], auth['pass'])
    exec_id = exec_api.start(args.name, app_descr)
    if not args.synchronous:
        print(
            "Application scheduled successfully with ID {}, use the exec-get command to check its status"
            .format(exec_id))
    else:
        print(
            "Application scheduled successfully with ID {}, waiting for status change"
            .format(exec_id))
        old_status = 'submitted'
        while True:
            execution = exec_api.get(exec_id)
            current_status = execution['status']
            if old_status != current_status:
                print('Execution is now {}'.format(current_status))
                old_status = current_status
            if current_status == 'running':
                break
            time.sleep(1)
        monitor_service_id = None
        service_api = ZoeServiceAPI(auth['url'], auth['user'], auth['pass'])
        for service_id in execution['services']:
            service = service_api.get(service_id)
            if service['description']['monitor']:
                monitor_service_id = service['id']
                break

        print('\n>------ start of log streaming -------<\n')
        why_stop = _log_stream_stdout(monitor_service_id, False, auth)
        print('\n>------ end of log streaming -------<\n')
        if why_stop == 'stream_end':
            print('Execution finished')
            exit(0)
        elif why_stop == 'interrupt':
            print('Do not worry, your execution ({}) is still running.'.format(
                exec_id))
            exit(1)
def exec_start_cmd(args):
    """Submit an execution."""
    app_descr = json.load(args.jsonfile)
    app_validate(app_descr)
    exec_api = ZoeExecutionsAPI(utils.zoe_url(), utils.zoe_user(), utils.zoe_pass())
    exec_id = exec_api.start(args.name, app_descr)
    if not args.synchronous:
        print("Application scheduled successfully with ID {}, use the exec-get command to check its status".format(exec_id))
    else:
        print("Application scheduled successfully with ID {}, waiting for status change".format(exec_id))
        old_status = 'submitted'
        while True:
            execution = exec_api.get(exec_id)
            current_status = execution['status']
            if old_status != current_status:
                print('Execution is now {}'.format(current_status))
                old_status = current_status
            if current_status == 'running':
                break
            time.sleep(1)
        monitor_service_id = None
        service_api = ZoeServiceAPI(utils.zoe_url(), utils.zoe_user(), utils.zoe_pass())
        for service_id in execution['services']:
            service = service_api.get(service_id)
            if service['description']['monitor']:
                monitor_service_id = service['id']
                break

        print('\n>------ start of log streaming -------<\n')
        why_stop = _log_stream_stdout(monitor_service_id, False)
        print('\n>------ end of log streaming -------<\n')
        if why_stop == 'stream_end':
            print('Execution finished')
            exit(0)
        elif why_stop == 'interrupt':
            print('Do not worry, your execution ({}) is still running.'.format(exec_id))
            exit(1)
Beispiel #6
0
def submit_zapp(zapp):
    """Submits one ZApp for execution."""
    exec_api = ZoeExecutionsAPI(zoe_url(), zoe_user(), zoe_pass())
    ret = exec_api.start('boinc-loader', zapp)
    return ret
def submit_zapp(zapp):
    """Submits one ZApp for execution."""
    exec_api = ZoeExecutionsAPI(zoe_url(), zoe_user(), zoe_pass())
    ret = exec_api.start('boinc-loader', zapp)
    return ret
def submit_zapp(zapp):
    """Submits one ZApp for execution."""
    exec_api = ZoeExecutionsAPI(zoe_url(), zoe_user(), zoe_pass())
    ret = exec_api.start('boinc-loader', zapp)
    print("Application scheduled successfully with ID {}, use the exec-get command to check its status".format(ret))