How to use parse_tarball_name method in autotest

Best Python code snippet using autotest_python

get_list_procs.py

Source:get_list_procs.py Github

copy

Full Screen

...63 #print("required_v1: {}, required_v2: {}".format(required_v1, required_v2))64 #print("tarballs: {}".format(pprint.pformat(tarballs)))65 if (required_v1 is None or required_v2 is None) and len(tarballs) != 0:66 for i in tarballs:67 parsed = wayround_i2p.utils.tarball.parse_tarball_name(68 i,69 mute=True70 )71 parsed_groups_version_list = parsed['groups']['version_list']72 is_nineties = check_nineties(parsed)73 is_development = check_development(parsed)74 if (75 (is_nineties76 and nineties_minors_are_acceptable == True77 )78 or (is_development79 and development_are_acceptable == True80 )81 or (not is_nineties82 and not is_development83 )84 ):85 #print(" {} passed".format(i))86 if required_v1 is None:87 required_v1 = int(parsed['groups']['version_list'][0])88 if required_v2 is None:89 required_v2 = int(parsed['groups']['version_list'][1])90 break91 # else:92 #print(" {} didn't passed".format(i))93 #print("required_v1: {}, required_v2: {}".format(required_v1, required_v2))94 found_required_targeted_tarballs = []95 for i in tarballs:96 parsed = wayround_i2p.utils.tarball.\97 parse_tarball_name(i, mute=True)98 if parsed:99 parsed_groups_version_list = parsed['groups']['version_list']100 if (int(parsed_groups_version_list[0]) == required_v1101 and102 int(parsed_groups_version_list[1]) == required_v2103 ):104 is_nineties = check_nineties(parsed)105 if ((is_nineties and nineties_minors_are_acceptable)106 or107 (not is_nineties)):108 found_required_targeted_tarballs.append(i)109 # print("found_required_targeted_tarballs: {}".format(110 # found_required_targeted_tarballs))111 if (len(found_required_targeted_tarballs) == 0112 and find_lower_version_if_required_missing == True):113 next_found_acceptable_tarball = None114 for i in tarballs:115 parsed = wayround_i2p.utils.tarball.\116 parse_tarball_name(i, mute=True)117 if parsed:118 parsed_groups_version_list = \119 parsed['groups']['version_list']120 int_parsed_groups_version_list_1 = \121 int(parsed_groups_version_list[1])122 if required_v2 is not None:123 if int_parsed_groups_version_list_1 >= required_v2:124 continue125 is_nineties = check_nineties(parsed)126 is_development = check_development(parsed)127 if next_found_acceptable_tarball is None:128 if (is_nineties129 and nineties_minors_are_acceptable == True130 and int_parsed_groups_version_list_1 < required_v2...

Full Screen

Full Screen

workspace.py

Source:workspace.py Github

copy

Full Screen

...91 candidate_events.append(event)92 self.events = [item for item in candidate_events if item.valid]93 self.invalid_events = list(set(candidate_events) - set(self.events))94 self.events.sort(key=lambda e: e.event_id)95 def parse_tarball_name(self, name):96 """97 Pulls apart the tarball data object's name in order to extract the the user, the export date and the export pid.98 These components should match up with at least two export flags.99 :param name: tarball data object name100 :return: tuple providing components of parsed data object name: exporter, exported time, and export pid. If101 the data object's name format is not observed, None is returned.102 """103 matches = re.match(r'dataset_u(.*)_t(.*)_p(.*).tgz', name, flags=0)104 if matches:105 exporter = self.dashboard.find_user_by_id(matches.group(1))106 return exporter, matches.group(2), matches.group(3)107 else:108 return None, None, None109 def display_properties(self):110 """111 Convenience method to handle a key : value display of workspace properties.112 """113 print("\nPROPERTIES:")114 properties_table = PrettyTable(["Property", "Value"])115 properties_table.align = "l"116 properties_table.add_row(["Id", self.id])117 properties_table.add_row(["Host", self.manager.get_host()])118 properties_table.add_row(["Default quota", self.quota + " Mb"])119 print(properties_table)120 def display_inventory(self, show_dataset_owners):121 """122 Prints a summary view of the workspace users contents123 :param show_dataset_owners: boolean controlling the content and arrangement of the inventory data.124 """125 self.generate_inventory(show_dataset_owners)126 print("\nINVENTORY:")127 inventory_table = PrettyTable(["User", "Dataset Id"])128 inventory_table.align["User"] = "l"129 inventory_table.align["Dataset Id"] = "r"130 if self.inventory:131 for item in self.inventory:132 if not show_dataset_owners and item['ctr'] > 0:133 row = ["", item['dataset']]134 else:135 row = [item['user'].formatted_user(), item['dataset']]136 inventory_table.add_row(row)137 print(inventory_table)138 else:139 print("Workspace currently unused.")140 def display_landing_zone_content(self):141 """142 Convenience method to handle tabular display of any residual tarballs in the landing zone. Tarballs should143 have the name format: dataset__u<user id>_t<timestamp in millsec>_p<pid>.tgz. Any items matching this144 format should have a corresponding pair of export flags in the flags collection. Anything that does not145 match the naming convention is simply detritus.146 """147 print("\nLANDING ZONE (Note: Any tarballs there should be short-lived):")148 landing_zone_table = PrettyTable(["Name", "Export Date", "Pid", "Exporter"])149 landing_zone_table.align["Name"] = "l"150 landing_zone_table.align["Export Date"] = "c"151 landing_zone_table.align["Pid"] = "r"152 landing_zone_table.align["Exporter"] = "l"153 tarball_names = self.manager.get_dataobj_names(paths.LANDING_ZONE_PATH)154 if tarball_names:155 for tarball_name in tarball_names:156 exporter, exported, pid = self.parse_tarball_name(tarball_name)157 if exporter is None:158 # tarball name not parseable159 landing_zone_table.add_row([tarball_name, "?", "?", "?"])160 else:161 pass162 row = [tarball_name,163 datetime.datetime.fromtimestamp(int(exported)/1000).strftime('%Y-%m-%d %H:%M:%S'),164 pid, exporter.formatted_user()]165 landing_zone_table.add_row(row)166 print(landing_zone_table)167 else:168 print("No exported tarballs remaining in the workspace")169 def display_staging_area_content(self):170 """...

Full Screen

Full Screen

rb52odim_combine_tarball.py

Source:rb52odim_combine_tarball.py Github

copy

Full Screen

...36# @param optparse.OptionParser object37def combine(options):38 tarball_fullfile=options.ifile39 print("Opening : %s" % tarball_fullfile)40 tb=parse_tarball_name(tarball_fullfile)41 big_obj=None42 tar=tarfile.open(tarball_fullfile)43 member_arr=tar.getmembers()44 nMEMBERs=len(member_arr)45 for iMEMBER in range(nMEMBERs):46 this_member=member_arr[iMEMBER]47 inp_fullfile=this_member.name48 mb=parse_tarball_member_name(inp_fullfile)49 if mb['rb5_ftype'] == "rawdata":50 obj_mb=tar.extractfile(this_member) #EXTRACTED MEMBER OBJECT51# isrb5=_rb52odim.isRainbow5buf(obj_mb) #alternately arg is an OBJ52# print("isrb5 = %s" % isrb5)53 rb5_buffer=obj_mb.read() #NOTE: once read(), buffer is detached from obj_mb54 isrb5=_rb52odim.isRainbow5buf(rb5_buffer)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful