From cb8e6ddb987e20d2b46106b38fefebc5c904b184 Mon Sep 17 00:00:00 2001 From: Jayasimha Raghavan Date: Fri, 15 Sep 2023 00:05:01 -0700 Subject: [PATCH 1/7] Traitlet error removal fix --- unskript-ctl/unskript-client.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/unskript-ctl/unskript-client.py b/unskript-ctl/unskript-client.py index 4f2291825..ccac27e52 100755 --- a/unskript-ctl/unskript-client.py +++ b/unskript-ctl/unskript-client.py @@ -612,6 +612,23 @@ def create_jit_runbook(check_list: list): except Exception as e: raise e + # The Recent Version of Docker, the unskript-ctl spews a lot of errors like this: + # + # ERROR:traitlets:Notebook JSON is invalid: Additional properties are not allowed ('orderProperties', 'description', + # 'version', 'name', 'inputschema', 'uuid', 'tags', 'type', 'language' were unexpected) + # This Failed validating 'additionalProperties' in code_cell: + # + # This is because the nbformat.write() complains about unknown attributes that are present + # in the IPYNB file. We dont need these attributes when we run the notebook via the Command Line. + # So we surgically eliminate these keys from the NB dictionary. + unknown_attrs = ['description', 'uuid', 'name', 'type', 'inputschema', 'version', 'orderProperties', 'tags', 'language'] + for cell in nb.get('cells'): + if cell.get('cell_type') is "code": + # This check is needed because the ID value is by default saved + # as integer in our code-snippets to enable drag-and-drop + cell['id'] = str(cell.get('id')) + for attr in unknown_attrs: + del cell[attr] nbformat.write(nb, failed_notebook) return failed_notebook @@ -1052,8 +1069,6 @@ def create_creds_mapping(): with open(creds, 'r') as f: c_data = json.load(f) if c_data.get('metadata').get('connectorData') == "{}": - print(f"WARNING: The Credential data for {c_data.get('metadata').get('type')} is empty!" - " Please use unskript-ctl.sh -cc option to create the credential") continue d[c_data.get('metadata').get('type')] = {"name": c_data.get('metadata').get('name'), "id": c_data.get('id')} From 4849573a88afe1b88c27d99c066f2d9e32753c67 Mon Sep 17 00:00:00 2001 From: Jayasimha Raghavan Date: Fri, 15 Sep 2023 09:56:58 -0700 Subject: [PATCH 2/7] PYLint error fixes --- unskript-ctl/unskript-client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unskript-ctl/unskript-client.py b/unskript-ctl/unskript-client.py index ccac27e52..33d607230 100755 --- a/unskript-ctl/unskript-client.py +++ b/unskript-ctl/unskript-client.py @@ -623,7 +623,7 @@ def create_jit_runbook(check_list: list): # So we surgically eliminate these keys from the NB dictionary. unknown_attrs = ['description', 'uuid', 'name', 'type', 'inputschema', 'version', 'orderProperties', 'tags', 'language'] for cell in nb.get('cells'): - if cell.get('cell_type') is "code": + if cell.get('cell_type') == "code": # This check is needed because the ID value is by default saved # as integer in our code-snippets to enable drag-and-drop cell['id'] = str(cell.get('id')) From b2a4c809d11977437388a07088a97233960a94cd Mon Sep 17 00:00:00 2001 From: Jayasimha Raghavan Date: Fri, 15 Sep 2023 10:33:20 -0700 Subject: [PATCH 3/7] Removed debugs and redundant table printing --- unskript-ctl/unskript-client.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/unskript-ctl/unskript-client.py b/unskript-ctl/unskript-client.py index 33d607230..8b42c391c 100755 --- a/unskript-ctl/unskript-client.py +++ b/unskript-ctl/unskript-client.py @@ -263,7 +263,6 @@ def run_ipynb(filename: str, status_list_of_dict: list = None): failed_result_available = False failed_result = {} - print(r) for result in r.split('\n'): if result == '': continue @@ -322,10 +321,6 @@ def run_ipynb(filename: str, status_list_of_dict: list = None): failed_result) idx += 1 - # New Line to make the output clear to see - print("") - print(tabulate(result_table, headers='firstrow', tablefmt='fancy_grid')) - if failed_result_available is True: print("") print("FAILED RESULTS") From 3f53f7c55c65cbe7bcd9713feb8e20d8ecf7c9e3 Mon Sep 17 00:00:00 2001 From: Jayasimha Raghavan Date: Fri, 15 Sep 2023 12:14:14 -0700 Subject: [PATCH 4/7] Fixed an issue with displaying SKIPPED message when testcases were skipped --- unskript-ctl/unskript-client.py | 176 ++++++++++++++++++-------------- 1 file changed, 101 insertions(+), 75 deletions(-) diff --git a/unskript-ctl/unskript-client.py b/unskript-ctl/unskript-client.py index 8b42c391c..e372b79a0 100755 --- a/unskript-ctl/unskript-client.py +++ b/unskript-ctl/unskript-client.py @@ -55,7 +55,7 @@ TBL_HDR_CHKS_FAIL="\033[35m Failed Checks \033[0m" TBL_HDR_CHKS_ERROR="\033[31m Errored Checks \033[0m" TBL_HDR_RBOOK_NAME="\033[36m Runbook Name \033[0m" -TBL_HDR_CHKS_COUNT="\033[32m Checks Count (Pass/Fail/Error) (Total checks) \033[0m" +TBL_HDR_CHKS_COUNT="\033[32m Checks Count (Pass/Fail/Error) (Total checks run) / (Skipped checks) \033[0m" TBL_CELL_CONTENT_PASS="\033[1m PASS \033[0m" TBL_CELL_CONTENT_FAIL="\033[1m FAIL \033[0m" TBL_CELL_CONTENT_ERROR="\033[1m ERROR \033[0m" @@ -65,7 +65,6 @@ TBL_HDR_LIST_CHKS_CONNECTOR="\033[36m Connector Name \033[0m" - def load_or_create_global_configuration(): """load_global_configuration This function reads the unskript_config.yaml file from /data and sets os.env variables which we shall use it in the subsequent functions. @@ -157,7 +156,7 @@ def insert_first_and_last_cell(nb: nbformat.NotebookNode) -> nbformat.NotebookNo cells = nb.dict().get('cells') if len(cells) == 0: # Empty runbook, nothing to be done. return back - print("ERROR: Runbook seems empty, nothing to run") + #print("ERROR: Runbook seems empty, nothing to run") return nb if cells[0].get('cell_type') == 'code': @@ -254,72 +253,92 @@ def run_ipynb(filename: str, status_list_of_dict: list = None): ids = get_code_cell_action_uuids(nb.dict()) result_table = [["Checks Name", "Result", "Failed Count", "Error"]] if len(outputs) == 0: - print("OUTPUT for the Check Action is Empty") - return - - results = outputs[0] + if UNSKRIPT_GLOBALS.get('skipped'): + for check_name,connector in UNSKRIPT_GLOBALS.get('skipped'): + result_table.append([ + check_name, + "SKIPPED", + "N/A", + "Credential Not Valid" + ]) + status_dict['result'].append([ + check_name, + "", + connector, + 'ERROR' + ]) + results = {} + if ids: + results = outputs[0] idx = 0 r = results.get('text') failed_result_available = False failed_result = {} - for result in r.split('\n'): - if result == '': - continue - payload = json.loads(result) - - try: - if CheckOutputStatus(payload.get('status')) == CheckOutputStatus.SUCCESS: - result_table.append([ - get_action_name_from_id(ids[idx], nb.dict()), - TBL_CELL_CONTENT_PASS, - 0, - 'N/A' - ]) - status_dict['result'].append([ - get_action_name_from_id(ids[idx], nb.dict()), - ids[idx], - get_connector_name_from_id(ids[idx], nb.dict()), - 'PASS'] - ) - elif CheckOutputStatus(payload.get('status')) == CheckOutputStatus.FAILED: - failed_objects = payload.get('objects') - failed_result[get_action_name_from_id(ids[idx], nb.dict())] = failed_objects - result_table.append([ - get_action_name_from_id(ids[idx], nb.dict()), - TBL_CELL_CONTENT_FAIL, - len(failed_objects), - 'N/A' - ]) - failed_result_available = True - status_dict['result'].append([ - get_action_name_from_id(ids[idx], nb.dict()), - ids[idx], - get_connector_name_from_id(ids[idx], nb.dict()), - 'FAIL' - ]) - elif CheckOutputStatus(payload.get('status')) == CheckOutputStatus.RUN_EXCEPTION: - result_table.append([ - get_action_name_from_id(ids[idx], nb.dict()), - TBL_CELL_CONTENT_ERROR, - 0, - payload.get('error') - ]) - status_dict['result'].append([ - get_action_name_from_id(ids[idx], nb.dict()), - ids[idx], - get_connector_name_from_id(ids[idx], nb.dict()), - 'ERROR' - ]) - except Exception: - pass - update_current_execution(payload.get('status'), ids[idx], nb.dict()) - update_check_run_trail(ids[idx], - get_action_name_from_id(ids[idx], nb.dict()), - get_connector_name_from_id(ids[idx], nb.dict()), - CheckOutputStatus(payload.get('status')), - failed_result) - idx += 1 + if ids: + for result in r.split('\n'): + if result == '': + continue + payload = json.loads(result) + + try: + if ids and CheckOutputStatus(payload.get('status')) == CheckOutputStatus.SUCCESS: + result_table.append([ + get_action_name_from_id(ids[idx], nb.dict()), + TBL_CELL_CONTENT_PASS, + 0, + 'N/A' + ]) + status_dict['result'].append([ + get_action_name_from_id(ids[idx], nb.dict()), + ids[idx], + get_connector_name_from_id(ids[idx], nb.dict()), + 'PASS'] + ) + elif ids and CheckOutputStatus(payload.get('status')) == CheckOutputStatus.FAILED: + failed_objects = payload.get('objects') + failed_result[get_action_name_from_id(ids[idx], nb.dict())] = failed_objects + result_table.append([ + get_action_name_from_id(ids[idx], nb.dict()), + TBL_CELL_CONTENT_FAIL, + len(failed_objects), + 'N/A' + ]) + failed_result_available = True + status_dict['result'].append([ + get_action_name_from_id(ids[idx], nb.dict()), + ids[idx], + get_connector_name_from_id(ids[idx], nb.dict()), + 'FAIL' + ]) + elif ids and CheckOutputStatus(payload.get('status')) == CheckOutputStatus.RUN_EXCEPTION: + result_table.append([ + get_action_name_from_id(ids[idx], nb.dict()), + TBL_CELL_CONTENT_ERROR, + 0, + payload.get('error') + ]) + status_dict['result'].append([ + get_action_name_from_id(ids[idx], nb.dict()), + ids[idx], + get_connector_name_from_id(ids[idx], nb.dict()), + 'ERROR' + ]) + else: + print("ELSE STATEMENT") + except Exception: + pass + if ids: + update_current_execution(payload.get('status'), ids[idx], nb.dict()) + update_check_run_trail(ids[idx], + get_action_name_from_id(ids[idx], nb.dict()), + get_connector_name_from_id(ids[idx], nb.dict()), + CheckOutputStatus(payload.get('status')), + failed_result) + idx += 1 + else: + print("") + print(tabulate(result_table, headers='firstrow', tablefmt='fancy_grid')) if failed_result_available is True: print("") @@ -418,7 +437,7 @@ def print_run_summary(status_list_of_dict): for sd in status_list_of_dict: if sd == {}: continue - p = f = e = 0 + p = f = e = s = 0 for st in sd.get('result'): status = st[-1] check_name = st[0] @@ -434,13 +453,16 @@ def print_run_summary(status_list_of_dict): e += 1 all_result_table.append( [check_name, 'N/A', 'N/A', TBL_CELL_CONTENT_ERROR]) - else: p = f = e = -1 - summary_table.append([ - sd.get('runbook'), - str(str(p) + ' / ' + str(f) + ' / ' + str(e) + ' ( ' + str(p+f+e) + ' ) ') - ]) + + if UNSKRIPT_GLOBALS.get('skipped'): + s = len(UNSKRIPT_GLOBALS.get('skipped')) + + summary_table.append([ + sd.get('runbook'), + str(str(p) + ' / ' + str(f) + ' / ' + str(e) + ' ( ' + str(p+f+e) + ' ) / ( ' + str(s) + ' )') + ]) s = '\x1B[1;20;46m' + "~~ Summary ~~" + '\x1B[0m' print(s) @@ -569,7 +591,10 @@ def create_jit_runbook(check_list: list): cred_name, cred_id = get_creds_by_connector(s_connector) # No point proceeding further if the Credential is incomplete if cred_name is None or cred_id is None: - print('\x1B[1;20;46m' + f"~~ Skipping {check.get('name')} {cred_name} {cred_id} ~~" + '\x1B[0m') + print('\x1B[1;20;46m' + f"~~ Skipping {check.get('name')} As {cred_name} Credential is Not Active ~~" + '\x1B[0m') + if UNSKRIPT_GLOBALS.get('skipped') == None: + UNSKRIPT_GLOBALS['skipped'] = [] + UNSKRIPT_GLOBALS['skipped'].append([check.get('name'), s_connector]) continue @@ -606,7 +631,6 @@ def create_jit_runbook(check_list: list): except Exception as e: raise e - # The Recent Version of Docker, the unskript-ctl spews a lot of errors like this: # # ERROR:traitlets:Notebook JSON is invalid: Additional properties are not allowed ('orderProperties', 'description', @@ -615,7 +639,7 @@ def create_jit_runbook(check_list: list): # # This is because the nbformat.write() complains about unknown attributes that are present # in the IPYNB file. We dont need these attributes when we run the notebook via the Command Line. - # So we surgically eliminate these keys from the NB dictionary. + # So we surgically eliminate these keys from the NB dictionary. unknown_attrs = ['description', 'uuid', 'name', 'type', 'inputschema', 'version', 'orderProperties', 'tags', 'language'] for cell in nb.get('cells'): if cell.get('cell_type') == "code": @@ -625,9 +649,12 @@ def create_jit_runbook(check_list: list): for attr in unknown_attrs: del cell[attr] nbformat.write(nb, failed_notebook) + + return failed_notebook + def update_check_run_trail( id: str, action_name: str, @@ -1591,5 +1618,4 @@ def stop_debug(): elif args.stop_debug is True: stop_debug() else: - parser.print_help() - + parser.print_help() \ No newline at end of file From 3d8e7d03a0008e85733cd3709ef51302946b20e2 Mon Sep 17 00:00:00 2001 From: Jayasimha Raghavan Date: Fri, 15 Sep 2023 15:01:03 -0700 Subject: [PATCH 5/7] Fixed PR Comments, Moved Failed Objects below Table --- unskript-ctl/unskript-client.py | 127 +++++++++++++++++++------------- 1 file changed, 74 insertions(+), 53 deletions(-) diff --git a/unskript-ctl/unskript-client.py b/unskript-ctl/unskript-client.py index e372b79a0..d111a4eec 100755 --- a/unskript-ctl/unskript-client.py +++ b/unskript-ctl/unskript-client.py @@ -82,6 +82,8 @@ def load_or_create_global_configuration(): else: _f_path = Path(GLOBAL_CONFIG_PATH) _f_path.touch() + with open(GLOBAL_CONFIG_PATH, 'w') as f: + f.write('globals:') def insert_first_and_last_cell(nb: nbformat.NotebookNode) -> nbformat.NotebookNode: @@ -125,11 +127,12 @@ def insert_first_and_last_cell(nb: nbformat.NotebookNode) -> nbformat.NotebookNo nbParamsObj = nbparams.NBParams(paramsJson) {runbook_variables} ''' - for k,v in UNSKRIPT_GLOBALS.get('globals').items(): - if isinstance(v,str) is True: - first_cell_content += f'{k} = \"{v}\"' + '\n' - else: - first_cell_content += f'{k} = {v}' + '\n' + if UNSKRIPT_GLOBALS.get('globals') and len(UNSKRIPT_GLOBALS.get('globals')): + for k,v in UNSKRIPT_GLOBALS.get('globals').items(): + if isinstance(v,str) is True: + first_cell_content += f'{k} = \"{v}\"' + '\n' + else: + first_cell_content += f'{k} = {v}' + '\n' first_cell_content += f''' w = Workflow(env, secret_store_cfg, None, global_vars=globals(), check_uuids={ids})''' @@ -162,7 +165,6 @@ def insert_first_and_last_cell(nb: nbformat.NotebookNode) -> nbformat.NotebookNo if cells[0].get('cell_type') == 'code': tags = None if cells[0].get('metadata').get('tags') is not None: - if len(cells[0].get('metadata').get('tags')) != 0: tags = cells[0].get('metadata').get('tags')[0] @@ -237,7 +239,6 @@ def run_ipynb(filename: str, status_list_of_dict: list = None): client = NotebookClient(nb=nb, kernel_name="python3") try: - execution = client.execute() except CellExecutionError as e: raise e @@ -312,6 +313,9 @@ def run_ipynb(filename: str, status_list_of_dict: list = None): 'FAIL' ]) elif ids and CheckOutputStatus(payload.get('status')) == CheckOutputStatus.RUN_EXCEPTION: + if payload.get('error') != None: + failed_objects = payload.get('error') + failed_result[get_action_name_from_id(ids[idx], nb.dict())] = failed_objects result_table.append([ get_action_name_from_id(ids[idx], nb.dict()), TBL_CELL_CONTENT_ERROR, @@ -324,8 +328,6 @@ def run_ipynb(filename: str, status_list_of_dict: list = None): get_connector_name_from_id(ids[idx], nb.dict()), 'ERROR' ]) - else: - print("ELSE STATEMENT") except Exception: pass if ids: @@ -336,19 +338,11 @@ def run_ipynb(filename: str, status_list_of_dict: list = None): CheckOutputStatus(payload.get('status')), failed_result) idx += 1 - else: - print("") - print(tabulate(result_table, headers='firstrow', tablefmt='fancy_grid')) + print("") + print(tabulate(result_table, headers='firstrow', tablefmt='fancy_grid')) if failed_result_available is True: - print("") - print("FAILED RESULTS") - for k, v in failed_result.items(): - check_name = '\x1B[1;4m' + k + '\x1B[0m' - print(check_name) - print("Failed Objects:") - pprint.pprint(v) - print('\x1B[1;4m', '\x1B[0m') + UNSKRIPT_GLOBALS['failed_result'] = failed_result print("") status_list_of_dict.append(status_dict) @@ -390,7 +384,17 @@ def run_checks(filter: str): run_ipynb(rb, status_of_runs) update_audit_trail(status_of_runs) - print_run_summary(status_of_runs) + #print_run_summary(status_of_runs) + if UNSKRIPT_GLOBALS.get('failed_result') and len(UNSKRIPT_GLOBALS.get('failed_result')): + print("") + print('\x1B[1;4m' + "FAILED RESULTS" + '\x1B[0m') + print("") + for k, v in UNSKRIPT_GLOBALS.get('failed_result').items(): + check_name = '\x1B[1;4m' + k + '\x1B[0m' + print(check_name) + print("Failed Objects:") + pprint.pprint(v) + print('\x1B[1;4m', '\x1B[0m') def run_suites(suite_name: str): @@ -422,6 +426,16 @@ def run_suites(suite_name: str): update_audit_trail(status_of_runs) print_run_summary(status_of_runs) + if UNSKRIPT_GLOBALS.get('failed_result') and len(UNSKRIPT_GLOBALS.get('failed_result')): + print("") + print('\x1B[1;4m' + "FAILED RESULTS" + '\x1B[0m') + print("") + for k, v in UNSKRIPT_GLOBALS.get('failed_result').items(): + check_name = '\x1B[1;4m' + k + '\x1B[0m' + print(check_name) + print("Failed Objects:") + pprint.pprint(v) + print('\x1B[1;4m', '\x1B[0m') def print_run_summary(status_list_of_dict): @@ -456,13 +470,13 @@ def print_run_summary(status_list_of_dict): else: p = f = e = -1 - if UNSKRIPT_GLOBALS.get('skipped'): - s = len(UNSKRIPT_GLOBALS.get('skipped')) - - summary_table.append([ - sd.get('runbook'), - str(str(p) + ' / ' + str(f) + ' / ' + str(e) + ' ( ' + str(p+f+e) + ' ) / ( ' + str(s) + ' )') - ]) + if UNSKRIPT_GLOBALS.get('skipped'): + s = len(UNSKRIPT_GLOBALS.get('skipped')) + + summary_table.append([ + sd.get('runbook'), + str(str(p) + ' / ' + str(f) + ' / ' + str(e) + ' ( ' + str(p+f+e) + ' ) / ( ' + str(s) + ' )') + ]) s = '\x1B[1;20;46m' + "~~ Summary ~~" + '\x1B[0m' print(s) @@ -497,7 +511,7 @@ def update_current_execution(status, id: str, content: dict): # If failed directory does not exists, lets create it if os.path.exists(os.environ.get('EXECUTION_DIR').strip('"') + '/workspace') is False: - os.mkdir(os.makedirs(os.environ.get('EXECUTION_DIR').strip('"') + '/workspace')) + os.makedirs(os.environ.get('EXECUTION_DIR').strip('"') + '/workspace') prev_status = None es = {} @@ -549,24 +563,26 @@ def update_current_execution(status, id: str, content: dict): def replace_input_with_globals(inputSchema: str): if not inputSchema: return None - - input_json_start_line = ''' + retval = '' + if UNSKRIPT_GLOBALS.get('globals') and len(UNSKRIPT_GLOBALS.get('globals')): + input_json_start_line = ''' task.configure(inputParamsJson=\'\'\'{ - ''' - input_json_end_line = '''}\'\'\') - ''' - input_json_line = '' - try: - schema = inputSchema[0] - if schema.get('properties'): - for key in schema.get('properties').keys(): - if key in UNSKRIPT_GLOBALS.get('globals').keys(): - input_json_line += f"\"{key}\": \"{key}\" ," - except Exception as e: - print(f"EXCEPTION {e}") - pass + ''' + input_json_end_line = '''}\'\'\') + ''' + input_json_line = '' + try: + schema = inputSchema[0] + if schema.get('properties'): + for key in schema.get('properties').keys(): + if key in UNSKRIPT_GLOBALS.get('globals').keys(): + input_json_line += f"\"{key}\": \"{key}\" ," + except Exception as e: + print(f"EXCEPTION {e}") + pass - retval = input_json_start_line + input_json_line.rstrip(',') + '\n' + input_json_end_line + retval = input_json_start_line + input_json_line.rstrip(',') + '\n' + input_json_end_line + return retval @@ -584,7 +600,10 @@ def create_jit_runbook(check_list: list): :rtype: None """ nb = nbformat.v4.new_notebook() - failed_notebook = os.environ.get('EXECUTION_DIR', '/unskript/data').strip('"') + '/workspace/' + str(uuid.uuid4()) + '.ipynb' + if os.path.exists(os.environ.get('EXECUTION_DIR') + '/workspace') == False: + os.makedirs(os.environ.get('EXECUTION_DIR') + '/workspace') + + failed_notebook = os.environ.get('EXECUTION_DIR', '/unskript/data/execution').strip('"') + '/workspace/' + str(uuid.uuid4()) + '.ipynb' for check in check_list: s_connector = check.get('metadata').get('action_type') s_connector = s_connector.replace('LEGO', 'CONNECTOR') @@ -1539,10 +1558,12 @@ def stop_debug(): if __name__ == "__main__": try: if os.environ.get('EXECUTION_DIR') is None: - os.environ['EXECUTION_DIR'] = '/unskript/data/execution' + os.environ['EXECUTION_DIR'] = '/unskript/data/execution' + if os.path.exists(os.environ.get('EXECUTION_DIR')) == False: + os.makedirs(os.environ.get('EXECUTION_DIR')) - create_creds_mapping() load_or_create_global_configuration() + create_creds_mapping() except Exception as error: raise error @@ -1560,8 +1581,8 @@ def stop_debug(): help='Run the given runbook FILENAME [-RUNBOOK_PARM1 VALUE1] etc..') parser.add_argument('-rc', '--run-checks', type=str, help='Run all available checks [all | connector | failed]') - # parser.add_argument('-rs', '--run-suites', type=str, - # help='Run Health Check Suites (as defined in the unskript_config.yaml file)') + #parser.add_argument('-rs', '--run-suites', type=str, + # help='Run Health Check Suites (as defined in the unskript_config.yaml file)') parser.add_argument('-df', '--display-failed-checks', help='Display Failed Checks [all | connector]') parser.add_argument('-lc', '--list-checks', type=str, @@ -1596,8 +1617,8 @@ def stop_debug(): parse_runbook_param(args.run_runbook) elif args.run_checks not in ('', None): run_checks(args.run_checks) - # elif args.run_suites not in ('', None): - # run_suites(args.run_suites) + #elif args.run_suites not in ('', None): + # run_suites(args.run_suites) elif args.display_failed_checks not in ('', None): display_failed_checks(args.display_failed_checks) elif args.list_checks not in ('', None): @@ -1618,4 +1639,4 @@ def stop_debug(): elif args.stop_debug is True: stop_debug() else: - parser.print_help() \ No newline at end of file + parser.print_help() From 2530f2c79962f3254c0278778af0fbe6f5745d76 Mon Sep 17 00:00:00 2001 From: Jayasimha Raghavan Date: Fri, 15 Sep 2023 15:09:10 -0700 Subject: [PATCH 6/7] Pylint Errors --- unskript-ctl/unskript-client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unskript-ctl/unskript-client.py b/unskript-ctl/unskript-client.py index d111a4eec..894d193f8 100755 --- a/unskript-ctl/unskript-client.py +++ b/unskript-ctl/unskript-client.py @@ -313,7 +313,7 @@ def run_ipynb(filename: str, status_list_of_dict: list = None): 'FAIL' ]) elif ids and CheckOutputStatus(payload.get('status')) == CheckOutputStatus.RUN_EXCEPTION: - if payload.get('error') != None: + if payload.get('error') is not None: failed_objects = payload.get('error') failed_result[get_action_name_from_id(ids[idx], nb.dict())] = failed_objects result_table.append([ @@ -600,7 +600,7 @@ def create_jit_runbook(check_list: list): :rtype: None """ nb = nbformat.v4.new_notebook() - if os.path.exists(os.environ.get('EXECUTION_DIR') + '/workspace') == False: + if os.path.exists(os.environ.get('EXECUTION_DIR') + '/workspace') is False: os.makedirs(os.environ.get('EXECUTION_DIR') + '/workspace') failed_notebook = os.environ.get('EXECUTION_DIR', '/unskript/data/execution').strip('"') + '/workspace/' + str(uuid.uuid4()) + '.ipynb' @@ -611,7 +611,7 @@ def create_jit_runbook(check_list: list): # No point proceeding further if the Credential is incomplete if cred_name is None or cred_id is None: print('\x1B[1;20;46m' + f"~~ Skipping {check.get('name')} As {cred_name} Credential is Not Active ~~" + '\x1B[0m') - if UNSKRIPT_GLOBALS.get('skipped') == None: + if UNSKRIPT_GLOBALS.get('skipped') is None: UNSKRIPT_GLOBALS['skipped'] = [] UNSKRIPT_GLOBALS['skipped'].append([check.get('name'), s_connector]) continue @@ -1559,7 +1559,7 @@ def stop_debug(): try: if os.environ.get('EXECUTION_DIR') is None: os.environ['EXECUTION_DIR'] = '/unskript/data/execution' - if os.path.exists(os.environ.get('EXECUTION_DIR')) == False: + if os.path.exists(os.environ.get('EXECUTION_DIR')) is False: os.makedirs(os.environ.get('EXECUTION_DIR')) load_or_create_global_configuration() From fd9dd37a41ea2166b403433eeb84c401cde868e1 Mon Sep 17 00:00:00 2001 From: Jayasimha Raghavan Date: Fri, 15 Sep 2023 15:21:39 -0700 Subject: [PATCH 7/7] PR Comments --- unskript-ctl/unskript-client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unskript-ctl/unskript-client.py b/unskript-ctl/unskript-client.py index 894d193f8..f535f77a1 100755 --- a/unskript-ctl/unskript-client.py +++ b/unskript-ctl/unskript-client.py @@ -260,7 +260,7 @@ def run_ipynb(filename: str, status_list_of_dict: list = None): check_name, "SKIPPED", "N/A", - "Credential Not Valid" + "Credential Incomplete" ]) status_dict['result'].append([ check_name, @@ -610,7 +610,7 @@ def create_jit_runbook(check_list: list): cred_name, cred_id = get_creds_by_connector(s_connector) # No point proceeding further if the Credential is incomplete if cred_name is None or cred_id is None: - print('\x1B[1;20;46m' + f"~~ Skipping {check.get('name')} As {cred_name} Credential is Not Active ~~" + '\x1B[0m') + #print('\x1B[1;20;46m' + f"~~ Skipping {check.get('name')} As {cred_name} Credential is Not Active ~~" + '\x1B[0m') if UNSKRIPT_GLOBALS.get('skipped') is None: UNSKRIPT_GLOBALS['skipped'] = [] UNSKRIPT_GLOBALS['skipped'].append([check.get('name'), s_connector])