int orte_sstore_central_global_register(orte_sstore_base_handle_t handle) { int ret, exit_status = ORTE_SUCCESS; orte_sstore_central_global_snapshot_info_t *handle_info = NULL; OPAL_OUTPUT_VERBOSE((10, mca_sstore_central_component.super.output_handle, "sstore:central:(global): register(%d) - Global", handle)); /* * Lookup the handle */ handle_info = find_handle_info(handle); if( SSTORE_GLOBAL_REG != handle_info->state ) { handle_info->state = SSTORE_GLOBAL_REG; } else { return orte_sstore_central_local_register(handle); } orte_sstore_handle_current = handle; /* * Associate the metadata */ if( handle_info->migrating ) { if( ORTE_SUCCESS != (ret = metadata_write_int(handle_info, SSTORE_METADATA_INTERNAL_MIG_SEQ_STR, handle_info->seq_num)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } } else { if( ORTE_SUCCESS != (ret = metadata_write_int(handle_info, SSTORE_METADATA_GLOBAL_SNAP_SEQ_STR, handle_info->seq_num)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } } if( ORTE_SUCCESS != (ret = metadata_write_str(handle_info, SSTORE_METADATA_LOCAL_SNAP_REF_FMT_STR, orte_sstore_base_local_snapshot_fmt)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } if( ORTE_SUCCESS != (ret = metadata_write_timestamp(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } cleanup: return exit_status; }
static int init_local_snapshot_directory(orte_sstore_central_app_snapshot_info_t *handle_info) { int ret, exit_status = ORTE_SUCCESS; mode_t my_mode = S_IRWXU; /* * Make the snapshot directory from the uniq_global_snapshot_name */ if(OPAL_SUCCESS != (ret = opal_os_dirpath_create(handle_info->local_location, my_mode)) ) { opal_show_help("help-orte-sstore-central.txt", "fail_path_create", true, ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), orte_process_info.nodename, handle_info->local_location); ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } /* * Open up the metadata file */ if( ORTE_SUCCESS != (ret = metadata_open(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } /* * Add a timestamp and the PID of this process */ if( ORTE_SUCCESS != (ret = metadata_write_timestamp(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } if( ORTE_SUCCESS != (ret = metadata_write_int(handle_info, SSTORE_METADATA_LOCAL_PID_STR, (int)getpid())) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } if( ORTE_SUCCESS != (ret = metadata_close(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } cleanup: return exit_status; }
int orte_sstore_central_app_sync(orte_sstore_base_handle_t handle) { int ret, exit_status = ORTE_SUCCESS; orte_sstore_central_app_snapshot_info_t *handle_info = NULL; OPAL_OUTPUT_VERBOSE((10, mca_sstore_central_component.super.output_handle, "sstore:central:(app): sync()")); /* * Lookup the handle */ handle_info = find_handle_info(handle); /* * Finalize and close the metadata */ if( ORTE_SUCCESS != (ret = metadata_write_timestamp(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } if( ORTE_SUCCESS != (ret = metadata_close(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } /* * Push information to the Local coordinator */ if( ORTE_SUCCESS != (ret = push_handle_info(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } cleanup: orte_sstore_handle_current = ORTE_SSTORE_HANDLE_INVALID; return exit_status; }
int orte_sstore_central_global_sync(orte_sstore_base_handle_t handle) { int ret, exit_status = ORTE_SUCCESS; orte_sstore_central_global_snapshot_info_t *handle_info = NULL; OPAL_OUTPUT_VERBOSE((10, mca_sstore_central_component.super.output_handle, "sstore:central:(global): sync()")); /* * Lookup the handle */ handle_info = find_handle_info(handle); if( SSTORE_GLOBAL_SYNCING != handle_info->state ) { handle_info->state = SSTORE_GLOBAL_SYNCING; if( ORTE_SNAPC_LOCAL_COORD_TYPE == (orte_snapc_coord_type & ORTE_SNAPC_LOCAL_COORD_TYPE) ) { return orte_sstore_central_local_sync(handle); } } /* * Synchronize all of the files */ while(handle_info->num_procs_synced < handle_info->num_procs_total) { opal_progress(); } /* * Finalize and close the metadata */ if( ORTE_SUCCESS != (ret = metadata_write_timestamp(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } if( handle_info->migrating ) { if( ORTE_SUCCESS != (ret = metadata_write_int(handle_info, SSTORE_METADATA_INTERNAL_DONE_MIG_SEQ_STR, handle_info->seq_num)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } } else { if( ORTE_SUCCESS != (ret = metadata_write_int(handle_info, SSTORE_METADATA_INTERNAL_DONE_SEQ_STR, handle_info->seq_num)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } } if( ORTE_SUCCESS != (ret = metadata_close(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } /* JJH: We should lock this var! */ if( !handle_info->migrating ) { orte_sstore_base_is_checkpoint_available = true; orte_sstore_handle_last_stable = orte_sstore_handle_current; } cleanup: return exit_status; }