def acs_update_azconfig(gen_cluster_config): config = acs_load_azconfig() configNew = acs_generate_azconfig() if not gen_cluster_config: if config is None: config = configNew acs_write_azconfig(config) else: if config is None: config = {} utils.mergeDict(config, configNew, False) acs_write_azconfig(config) return config
def __init__(self, expr, tokens={}, placeHolder=0): self.expr, newTokens = tokenize(expr, placeHolder) for k in newTokens: if newTokens[k][0]=='(' and newTokens[k][-1]==')': newTokens[k] = newTokens[k][1:-1] tokens = mergeDict(tokens, newTokens) self.tokens = {} tokenKeys = extractPlaceHolderRE(self.expr) for k in tokenKeys: self.tokens[k] = ExpressionTree(tokens[k], tokens, placeHolder=placeHolder+len(tokens))
def acs_update_azconfig(gen_cluster_config): acs_config = acs_load_azconfig() if not gen_cluster_config: if acs_config is None: acs_config = acs_generate_azconfig() acs_update_machines(acs_config) acs_write_azconfig(acs_config) else: acs_init_azconfig() bModified = acs_update_machines(acs_config) if bModified: acs_write_azconfig(acs_config) else: configNew = acs_generate_azconfig() if acs_config is None: acs_config = {} acs_update_machines(acs_config) utils.mergeDict(acs_config, configNew, False) acs_write_azconfig(acs_config) return acs_config
def parseStdout(f, result, mapKL, mapKV, solList): l_SolLast = "" n_SolStatus = 0 result["Number_Solutions"] = 0 for line in f: line = line.rstrip() ## To remove \n and spaces on the right res00 = { } ## A temporary to see if we get a feasible solution separator checkKeylines(line, mapKL, res00) utils.mergeDict(result, res00) checkKeyvalues(line, mapKV, result) ## See if it's a solution status if "Sol_Status" in res00: if 1 == res00["Sol_Status"][0]: result["Number_Solutions"] += 1 ## result["Solution_Last"] = l_SolLast ## Or save it? Need from a file then but might be great to have here if None != solList: solList.append(l_SolLast) l_SolLast = "" ## Clean up else: l_SolLast += line l_SolLast += '\n'
def tokenize(expr, placeHolder=0): tokens={} for idxFinder in [ ssf.InnerParenthesisFinder().find, ssf.KeyWordsFinder().find, ssf.KeyWordsArgsFinder().find, ssf.FactorialFinder().find, ssf.PowRootFinder().find, ssf.MultDivFinder().find, ssf.AddSubFinder().find ]: expr, newTokens = decompose(expr, idxFinder, placeHolder+len(tokens.keys())) tokens = mergeDict(tokens, newTokens) return expr, tokens
both config.yaml and the complementary file generated are used to describe one-time action scaleup Scale up operation. scaledown shutdown a particular VM. list list VMs. interconnect create network links among VMs genconfig Generate configuration files to describe the static status for Azure VM cluster. ''')) parser.add_argument("command", help="See above for the list of valid command") parser.add_argument('nargs', nargs=argparse.REMAINDER, help="Additional command argument") output_file_name = "azcluster.yaml" parser.add_argument( "--complementary", help="Specify complementary file name the number of infra nodes", action="store", default="complementary.yaml") args = parser.parse_args() command = args.command nargs = args.nargs default_config = init_config() # print(config["azure_cluster"]) config_file = os.path.join(dirpath, "config.yaml") if os.path.exists(config_file): with open(config_file) as cf: config = yaml.safe_load(cf) mergeDict(config, default_config, False) # print(config["azure_cluster"]) run_command(command, config, args, nargs)