def setup_java_system_properties(cl_args): java_system_props = [] twister2_home = config.get_twister2_dir() if os.environ.get('TWISTER2_HOME'): twister2_home = os.environ.get('TWISTER2_HOME') # lets set the system property java_system_props.append("twister2_home=" + twister2_home) # set the cluster name property java_system_props.append("cluster_type=" + cl_args["cluster"]) # set debug mode java_system_props.append("debug=" + str(cl_args['debug'])) # set the job file java_system_props.append("job_file=" + cl_args['job-file-name']) # set the job type java_system_props.append("job_type=" + cl_args['job-type']) # set the logger file conf_dir_common = config.get_twister2_cluster_conf_dir( "common", config.get_twister2_conf_dir()) conf_dir = config.get_twister2_cluster_conf_dir( cl_args["cluster"], config.get_twister2_conf_dir()) if os.path.isfile(conf_dir + "/logger.properties"): java_system_props.append("java.util.logging.config.file=" + conf_dir + "/logger.properties") elif os.path.isfile(conf_dir_common + "/logger.properties"): java_system_props.append("java.util.logging.config.file=" + conf_dir_common + "/logger.properties") return java_system_props
def read_client_properties(cl_args): conf_dir_common = config.get_twister2_cluster_conf_dir("common", config.get_twister2_conf_dir()) common_client_config = {} if os.path.isfile(conf_dir_common + "/resource.yaml"): with open(conf_dir_common + "/resource.yaml", 'r') as stream: data_loaded = yaml.load(stream,Loader=yaml.FullLoader) return data_loaded conf_dir = config.get_twister2_cluster_conf_dir(cl_args["cluster"], config.get_twister2_conf_dir()) if os.path.isfile(conf_dir + "/resource.yaml"): with open(conf_dir + "/resource.yaml", 'r') as stream: data_loaded = yaml.load(stream, Loader=yaml.FullLoader) common_client_config.update(data_loaded) return data_loaded
def read_client_properties(cl_args): conf_dir = config.get_twister2_cluster_conf_dir( cl_args["cluster"], config.get_twister2_conf_dir()) if os.path.isfile(conf_dir + "/client.yaml"): with open(conf_dir + "/client.yaml", 'r') as stream: data_loaded = yaml.load(stream) return data_loaded
def run(command, cl_args, action, extra_args=[], extra_lib_jars=[]): ''' helper function to take action on topologies :param command: :param cl_args: :param action: description of action taken :return: ''' job_id = cl_args['job-id'] new_args = [ "--cluster", cl_args['cluster'], "--twister2_home", config.get_twister2_dir(), "--config_path", config.get_twister2_conf_dir(), "--job_id", job_id, "--command", command, ] new_args += extra_args lib_jars = config.get_twister2_libs(jars.resource_scheduler_jars() + jars.statemgr_jars()) lib_jars += extra_lib_jars if Log.getEffectiveLevel() == logging.DEBUG: new_args.append("--verbose") java_defines = [] conf_dir_common = config.get_twister2_cluster_conf_dir( "common", config.get_twister2_conf_dir()) java_defines.append("java.util.logging.config.file=" + conf_dir_common + "/logger.properties") # invoke the runtime manager to kill the job result = execute.twister2_class( 'edu.iu.dsc.tws.rsched.core.RuntimeManagerMain', lib_jars, extra_jars=[], args=new_args, java_defines=java_defines) err_msg = "Failed to %s %s" % (action, job_id) succ_msg = "Successfully %s %s" % (action, job_id) result.add_context(err_msg, succ_msg) return result
def run(command, parser, args, unknown_args): ''' :param command: :param parser: :param args: :param unknown_args: :return: ''' job_id = args['job-id'] conf_path = os.path.join(config.get_twister2_dir(), "conf/common") new_args = [ "--twister2_home", config.get_twister2_dir(), "--config_path",conf_path, "--job_id", job_id, "--command", command, ] new_args += unknown_args lib_jars = config.get_twister2_libs(jars.resource_scheduler_jars()) if Log.getEffectiveLevel() == logging.DEBUG: new_args.append("--verbose") java_defines = [] conf_dir_common = config.get_twister2_cluster_conf_dir("common", config.get_twister2_conf_dir()) java_defines.append("java.util.logging.config.file=" + conf_dir_common + "/logger.properties") # invoke the runtime manager to kill the job result = execute.twister2_class( 'edu.iu.dsc.tws.rsched.job.ZKJobLister', lib_jars, extra_jars=[], args=new_args, java_defines=java_defines ) err_msg = "Failed to %s %s" % (command, job_id) succ_msg = "Successfully %s %s" % (command, job_id) result.add_context(err_msg, succ_msg) return result