def main(args): """ Read args passed to script, load tokens and run watchdog. Keyword arguments: :param args: arguments parsed by argparse ArgumentParser :return: returns status code 0 on successful completion """ jenkins_server = args.jenkins_server.strip() jenkins_user = args.jenkins_user.strip() jenkins_token = open(args.jenkins_token).read().replace('\n', '').strip() msteams_url = open(args.msteams_url).read().replace('\n', '').strip() github_credentials = args.github_credentials github_org = args.github_org github_project = args.github_project ci_job = args.ci_job.strip() watchdog_job = args.watchdog_job.strip() quiet = args.quiet wd = Watchdog(jenkins_token=jenkins_token, jenkins_server=jenkins_server, jenkins_user=jenkins_user, github_credentials=github_credentials, git_org=github_org, git_project=github_project, msteams_url=msteams_url, ci_job_name=ci_job, watchdog_job_name=watchdog_job) wd.run(quiet=quiet) return 0
task['type'] = 'add_order_or_watchdog' elif data['type'] == 'clear_order': task['type'] = 'clear_order' elif data['type'] == 'cost': task['type'] = 'receive_cost' elif data['type'] == 'acknowledge_order': task['type'] = 'acknowledge_order' add_task(task) #elevator.run(MY_ID, add_task) elevator = Elevator(MY_ID, add_task) elevator.run() #watchdog.run(add_task) watchdog = Watchdog(add_task) watchdog.run() network.run(add_task_from_message) def order_watcher(): global ordersAndCosts while True: current_time = int(time.time()) popList = [] for element in ordersAndCosts: if element['timestamp'] + ORDER_WATCHER_LIMIT < current_time: #print(f'Costs: {element}') if len(element['costs']) > 0: lowest_cost = 1000 for costElement in element['costs']: if costElement['cost'] < lowest_cost: