mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-30 22:54:18 +00:00 
			
		
		
		
	utils/types: toggle_set: add "~~" semantics
Add support for "~~" special value that indicates that, when merging into another set, all values from that set should in fact be dropped. Apart from the unique merge semantics, "~~" just like any other "~" value.
This commit is contained in:
		
				
					committed by
					
						 Marc Bonnici
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							9093477f1b
						
					
				
				
					commit
					aacba47f9a
				
			| @@ -92,7 +92,7 @@ class RunCommand(Command): | ||||
|         self.logger.debug('Version: {}'.format(get_wa_version())) | ||||
|         self.logger.debug('Command Line: {}'.format(' '.join(sys.argv))) | ||||
|  | ||||
|         disabled_augmentations = toggle_set(["~{}".format(i) | ||||
|         disabled_augmentations = toggle_set([i != '~~' and "~{}".format(i) or i | ||||
|                                            for i in args.augmentations_to_disable]) | ||||
|         config.jobs_config.disable_augmentations(disabled_augmentations) | ||||
|         config.jobs_config.only_run_ids(args.only_run_ids) | ||||
|   | ||||
| @@ -957,6 +957,8 @@ class JobGenerator(object): | ||||
|  | ||||
|     def disable_augmentations(self, augmentations): | ||||
|         for entry in augmentations: | ||||
|             if entry == '~~': | ||||
|                 continue | ||||
|             if entry.startswith('~'): | ||||
|                 entry = entry[1:] | ||||
|             try: | ||||
|   | ||||
| @@ -306,7 +306,10 @@ def _construct_valid_entry(raw, seen_ids, prefix, jobs_config): | ||||
|             workload_entry[name] = value | ||||
|  | ||||
|     if "augmentations" in workload_entry: | ||||
|         jobs_config.update_augmentations(workload_entry["augmentations"]) | ||||
|         if '~~' in workload_entry['augmentations']: | ||||
|             msg = '"~~" can only be specfied in top-level config, and not for individual workloads/sections' | ||||
|             raise ConfigError(msg) | ||||
|         jobs_config.update_augmentations(workload_entry['augmentations']) | ||||
|  | ||||
|     # error if there are unknown workload_entry | ||||
|     if raw: | ||||
|   | ||||
| @@ -370,6 +370,9 @@ class toggle_set(set): | ||||
|  | ||||
|     @staticmethod | ||||
|     def merge(source, dest): | ||||
|         if '~~' in dest: | ||||
|             dest.remove('~~') | ||||
|             return dest | ||||
|         for item in source: | ||||
|             if item not in dest: | ||||
|                 #Disable previously enabled item | ||||
|   | ||||
		Reference in New Issue
	
	Block a user