void hook_manager_init_post_hook( hook_manager_type * hook_manager , const config_content_type * config) { if (config_content_has_item( config , QC_PATH_KEY )) hook_manager_set_path( hook_manager, config_content_get_value( config , QC_PATH_KEY )); if (config_content_has_item( config , QC_WORKFLOW_KEY)) { const char * file_name = config_content_get_value_as_path(config , QC_WORKFLOW_KEY); char * workflow_name; util_alloc_file_components( file_name , NULL , &workflow_name , NULL ); { workflow_type * workflow = ert_workflow_list_add_workflow( hook_manager->workflow_list , file_name , workflow_name); if (workflow != NULL) { ert_workflow_list_add_alias( hook_manager->workflow_list , workflow_name , QC_WORKFLOW_NAME ); hook_workflow_set_workflow( hook_manager->post_hook_workflow, workflow ); } hook_workflow_set_run_mode( hook_manager->post_hook_workflow, RUN_MODE_POST_SIMULATION_NAME); } } }
bool site_config_init(site_config_type * site_config, const config_content_type * config) { site_config_add_jobs(site_config, config); site_config_init_env(site_config, config); /* When LSF is used several enviroment variables must be set (by the site wide file) - i.e. the calls to SETENV must come first. */ if (!site_config->user_mode) site_config_create_queue_drivers(site_config); /* Set the umask for all file creation. A value of '0' will ensure that all files and directories are created with 'equal rights' for everyone - might be handy if you are helping someone... The default statoil value is 0022, i.e. write access is removed from group and others. The string is supposed to be in OCTAL representation (without any prefix characters). */ if (config_content_has_item(config, UMASK_KEY)) { const char * string_mask = config_content_get_value(config, UMASK_KEY); mode_t umask_value; if (util_sscanf_octal_int(string_mask, &umask_value)) site_config_set_umask(site_config, umask_value); else util_abort("%s: failed to parse:\"%s\" as a valid octal literal \n", __func__, string_mask); } if (config_content_has_item(config, MAX_SUBMIT_KEY)) site_config_set_max_submit(site_config, config_content_get_value_as_int(config, MAX_SUBMIT_KEY)); /* LSF options */ { if (config_content_has_item(config, LSF_QUEUE_KEY)) site_config_set_lsf_queue(site_config, config_content_get_value(config, LSF_QUEUE_KEY)); if (config_content_has_item(config, LSF_RESOURCES_KEY)) { char * lsf_resource_request = config_content_alloc_joined_string(config, LSF_RESOURCES_KEY, " "); site_config_set_lsf_request(site_config, lsf_resource_request); free(lsf_resource_request); } if (config_content_has_item(config, MAX_RUNNING_LSF_KEY)) site_config_set_max_running_lsf(site_config, config_content_get_value_as_int(config, MAX_RUNNING_LSF_KEY)); if (config_content_has_item(config, LSF_SERVER_KEY)) site_config_set_lsf_server(site_config, config_content_get_value(config, LSF_SERVER_KEY)); } /* RSH options */ { if (config_content_has_item(config, RSH_COMMAND_KEY)) site_config_set_rsh_command(site_config, config_content_get_value(config, RSH_COMMAND_KEY)); if (config_content_has_item(config, MAX_RUNNING_RSH_KEY)) site_config_set_max_running_rsh(site_config, config_content_get_value_as_int(config, MAX_RUNNING_RSH_KEY)); /* Parsing the "host1:4" strings. */ if (config_content_has_item( config , RSH_HOST_KEY)) { stringlist_type * rsh_host_list = config_content_alloc_complete_stringlist(config, RSH_HOST_KEY); int i; for (i = 0; i < stringlist_get_size(rsh_host_list); i++) site_config_add_rsh_host_from_string(site_config, stringlist_iget(rsh_host_list, i)); stringlist_free(rsh_host_list); } } if (config_content_has_item(config, QUEUE_SYSTEM_KEY)) { job_driver_type driver_type; { const char * queue_system = config_content_get_value(config, QUEUE_SYSTEM_KEY); if (strcmp(queue_system, LSF_DRIVER_NAME) == 0) { driver_type = LSF_DRIVER; } else if (strcmp(queue_system, RSH_DRIVER_NAME) == 0) driver_type = RSH_DRIVER; else if (strcmp(queue_system, LOCAL_DRIVER_NAME) == 0) driver_type = LOCAL_DRIVER; else if (strcmp(queue_system, TORQUE_DRIVER_NAME) == 0) driver_type = TORQUE_DRIVER; else { util_abort("%s: queue system :%s not recognized \n", __func__, queue_system); driver_type = NULL_DRIVER; } } site_config_set_job_queue__(site_config, driver_type); } /* Parsing local options */ if (config_content_has_item(config, MAX_RUNNING_LOCAL_KEY)) site_config_set_max_running_local(site_config, config_content_iget_as_int(config, MAX_RUNNING_LOCAL_KEY, 0, 0)); if (config_content_has_item(config, JOB_SCRIPT_KEY)) site_config_set_job_script(site_config, config_content_get_value_as_abspath(config, JOB_SCRIPT_KEY)); if (config_content_has_item(config, LICENSE_PATH_KEY)) site_config_set_license_root_path(site_config, config_content_get_value_as_abspath(config, LICENSE_PATH_KEY)); site_config_install_job_queue(site_config); /* Setting QUEUE_OPTIONS */ { int i; for (i = 0; i < config_content_get_occurences(config, QUEUE_OPTION_KEY); i++) { const stringlist_type * tokens = config_content_iget_stringlist_ref(config, QUEUE_OPTION_KEY, i); const char * driver_name = stringlist_iget(tokens, 0); const char * option_key = stringlist_iget(tokens, 1); const char * option_value = stringlist_alloc_joined_substring(tokens, 2, stringlist_get_size(tokens), " "); /* If it is desirable to keep the exact number of spaces in the option_value it should be quoted with "" in the configuration file. */ site_config_set_queue_option(site_config, driver_name, option_key, option_value); } } return true; }
void hook_manager_init( hook_manager_type * hook_manager , const config_content_type * config) { if (config_content_has_item( config, RUNPATH_FILE_KEY)) hook_manager_set_runpath_list_file(hook_manager, NULL, config_content_get_value(config, RUNPATH_FILE_KEY)); }
void ecl_config_init(ecl_config_type * ecl_config, const config_content_type * config) { if (config_content_has_item(config, ECLBASE_KEY)) { ui_return_type * ui_return = ecl_config_validate_eclbase(ecl_config, config_content_iget(config, ECLBASE_KEY, 0, 0)); if (ui_return_get_status(ui_return) == UI_RETURN_OK) ecl_config_set_eclbase(ecl_config, config_content_iget(config, ECLBASE_KEY, 0, 0)); else util_abort("%s: failed to set eclbase format. Error:%s\n", __func__ , ui_return_get_last_error(ui_return)); ui_return_free(ui_return); } if (config_content_has_item(config, DATA_FILE_KEY)) { ui_return_type * ui_return = ecl_config_validate_data_file(ecl_config, config_content_iget(config, DATA_FILE_KEY, 0, 0)); if (ui_return_get_status( ui_return ) == UI_RETURN_OK) ecl_config_set_data_file( ecl_config, config_content_iget(config, DATA_FILE_KEY, 0, 0) ); else util_abort("%s: problem setting ECLIPSE data file\n",__func__ , ui_return_get_last_error(ui_return)); ui_return_free(ui_return); } if (config_content_has_item(config, SCHEDULE_FILE_KEY)) { const char * schedule_target_file = config_content_safe_iget(config, SCHEDULE_FILE_KEY, 0, 1); if (schedule_target_file) { ui_return_type * ui_return_sched_target_file = ecl_config_validate_schedule_file(ecl_config, schedule_target_file); if (!ui_return_get_status(ui_return_sched_target_file) == UI_RETURN_OK) { util_abort("%s: failed to set target schedule file. Error:%s\n",__func__ , ui_return_get_last_error(ui_return_sched_target_file)); } ui_return_free(ui_return_sched_target_file); } ui_return_type * ui_return = ecl_config_validate_schedule_file(ecl_config, config_content_iget(config, SCHEDULE_FILE_KEY, 0, 0)); if (ui_return_get_status(ui_return) == UI_RETURN_OK) ecl_config_set_schedule_file(ecl_config, config_content_iget(config, SCHEDULE_FILE_KEY, 0, 0), schedule_target_file); else util_abort("%s: failed to set schedule file. Error:%s\n",__func__ , ui_return_get_last_error(ui_return)); ui_return_free(ui_return); } if (config_content_has_item(config, GRID_KEY)) { const char * grid_file = config_content_iget(config, GRID_KEY, 0, 0); ui_return_type * ui_return = ecl_config_validate_grid( ecl_config , grid_file); if (ui_return_get_status(ui_return) == UI_RETURN_OK) ecl_config_set_grid(ecl_config, grid_file ); else util_abort("%s: failed to set grid file:%s Error:%s \n",__func__ , grid_file , ui_return_get_last_error(ui_return)); ui_return_free( ui_return ); } if (config_content_has_item(config, ADD_FIXED_LENGTH_SCHEDULE_KW_KEY)) { int iocc; for (iocc = 0; iocc < config_content_get_occurences(config, ADD_FIXED_LENGTH_SCHEDULE_KW_KEY); iocc++) ecl_config_add_fixed_length_schedule_kw(ecl_config, config_content_iget(config, ADD_FIXED_LENGTH_SCHEDULE_KW_KEY, iocc, 0), config_content_iget_as_int(config, ADD_FIXED_LENGTH_SCHEDULE_KW_KEY, iocc, 1)); } if (config_content_has_item(config, REFCASE_KEY)) { const char * refcase_path = config_content_get_value_as_path(config, REFCASE_KEY); if (!ecl_config_load_refcase(ecl_config, refcase_path)) fprintf(stderr, "** Warning: loading refcase:%s failed \n", refcase_path); } if (config_content_has_item(config, REFCASE_LIST_KEY)) { config_content_item_type * item = config_content_get_item(config, REFCASE_LIST_KEY); int i; for (i = 0; i < config_content_item_get_size(item); i++) { config_content_node_type * node = config_content_item_iget_node(item, i); int j; for (j = 0; j < config_content_node_get_size(node); j++) { const char * case_glob = config_content_node_iget_as_path(node, j); ecl_refcase_list_add_matching(ecl_config->refcase_list, case_glob); } } } if (config_content_has_item(config, INIT_SECTION_KEY)) ecl_config_set_init_section(ecl_config, config_content_get_value(config, INIT_SECTION_KEY)); else if (ecl_config->can_restart) /** This is a hard error - the datafile contains <INIT>, however the config file does NOT contain INIT_SECTION, i.e. we have no information to fill in for the <INIT> section. This case will not be able to initialize an ECLIPSE model, and that is broken behaviour. */ util_exit("Sorry: when the datafile contains <INIT> the config file MUST have the INIT_SECTION keyword. \n"); /* The user has not supplied a INIT_SECTION keyword whatsoever, this essentially means that we can not restart - because: 1. The EQUIL section must be inlined in the DATAFILE without any special markup. 2. ECLIPSE will fail hard if the datafile contains both an EQUIL section and a restart statement, and when we have not marked the EQUIL section specially with the INIT_SECTION keyword it is impossible for ERT to dynamically change between a datafile with initialisation and a datafile for restart. IFF the user has no intentitions of any form of restart, this is perfectly legitemate. */ if (config_content_has_item(config, END_DATE_KEY)) { const char * date_string = config_content_get_value(config, END_DATE_KEY); time_t end_date; if (util_sscanf_date_utc(date_string, &end_date)) ecl_config_set_end_date(ecl_config, end_date); else fprintf(stderr, "** WARNING **: Failed to parse %s as a date - should be in format dd/mm/yyyy \n", date_string); } }