Exemple #1
0
def list_restarts(model_context, exit_code):
    """
    Get the list of restarts and save this list in format to restart.file
    in the -output_dirs location. If the output_dirs is not included, bypass
    writing to the restart file.
    :param model_context: instance of the tool model context
    :param exit_code: current exit code for online restarts
    """
    _method_name = 'list_restarts'
    _logger.entering(model_context.get_output_dir(), class_name=_class_name, method_name=_method_name)
    restart_list = get_list_of_restarts()
    output_dirs = model_context.get_output_dir()
    result = exit_code
    if len(restart_list) == 0:
        result = 0
    elif output_dirs is not None:
        file_name = os.path.join(output_dirs, 'restart.file')
        pw = FileUtils.getPrintWriter(file_name)
        for entry in restart_list:
            line = '%s:%s:%s:%s' % (entry[0], entry[1], entry[2], entry[3])
            _logger.finer('WLSDPLY-09208', line, class_name=_class_name, method_name=_method_name)
            pw.println(line)
        pw.close()
    _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
    return result
Exemple #2
0
def list_non_dynamic_changes(model_context, non_dynamic_changes_string):
    """
    If output dir is present in the model context, write the restart data to the output dir as non_dynamic_changes.file.
    :param model_context: Current context with the run parameters.
    :param non_dynamic_changes_string: java.lang.String of changes that were non dynamic
    """
    _method_name = 'list_non_dynamic_changes'
    _logger.entering(class_name=_class_name, method_name=_method_name)
    output_dir = model_context.get_output_dir()
    if len(str(non_dynamic_changes_string)) > 0 and output_dir is not None:
        file_name = os.path.join(output_dir, 'non_dynamic_changes.file')
        pw = FileUtils.getPrintWriter(file_name)
        pw.println(non_dynamic_changes_string)
        pw.close()