CMAKE_DEPENDENT_OPTION(SALOME_USE_MPI "Use MPI containers" ${SALOME_USE_MPI}
"NOT SALOME_LIGHT_ONLY" OFF)
MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_LIBBATCH SALOME_USE_SIMAN SALOME_PACO_PARALLEL SALOME_USE_PORTMANAGER)
-SET(SALOME_LAUNCHER_ONLY OFF) # deprecated option: Build only the Launcher part
# Required prerequisites
# Find "big" prerequisites first - they reference themselves many others
# List of targets in this project we want to make visible to the rest of the world.
# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
-IF(SALOME_LAUNCHER_ONLY)
- SET(_${PROJECT_NAME}_exposed_targets
- SALOMEBasics ResourcesManager Launcher)
-ELSE()
- SET(_${PROJECT_NAME}_exposed_targets
- SALOMEBasics SALOMELocalTrace SalomeHDFPersist OpUtil)
+SET(_${PROJECT_NAME}_exposed_targets
+ SALOMEBasics SALOMELocalTrace SalomeHDFPersist OpUtil)
- # CORBA specific targets:
- IF(NOT SALOME_LIGHT_ONLY)
+# CORBA specific targets:
+IF(NOT SALOME_LIGHT_ONLY)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ DF SalomeLoggerServer with_loggerTraceCollector SalomeNS SalomeGenericObj
+ Registry SalomeCatalog ResourcesManager SalomeResourcesManager
+ SalomeNotification SalomeContainer SalomeSDS Launcher SalomeLauncher
+ SalomeLifeCycleCORBA SalomeDSClient TOOLSDS SalomeKernelHelpers
+ SalomeDSImpl SalomeDS SalomeCommunication SalomeDSCContainer)
+ # Temporary solution for package src\DSC on windows
+ IF(NOT WIN32)
LIST(APPEND _${PROJECT_NAME}_exposed_targets
- DF SalomeLoggerServer with_loggerTraceCollector SalomeNS SalomeGenericObj
- Registry SalomeCatalog ResourcesManager SalomeResourcesManager
- SalomeNotification SalomeContainer SalomeSDS Launcher SalomeLauncher
- SalomeLifeCycleCORBA SalomeDSClient TOOLSDS SalomeKernelHelpers
- SalomeDSImpl SalomeDS SalomeCommunication SalomeDSCContainer)
- # Temporary solution for package src\DSC on windows
- IF(NOT WIN32)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets
- CalciumC SalomeCalcium SalomeDatastream SalomePalm SalomeDSCSupervBasic
- SalomeDSCSuperv)
- IF(SALOME_PACO_PARALLEL)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomeParallelDSCContainer)
- ENDIF()
+ CalciumC SalomeCalcium SalomeDatastream SalomePalm SalomeDSCSupervBasic
+ SalomeDSCSuperv)
+ IF(SALOME_PACO_PARALLEL)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomeParallelDSCContainer)
ENDIF()
ENDIF()
+ENDIF()
- # MPI specific targets:
- IF(SALOME_USE_MPI)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets
- SalomeMPIContainer SalomeTestMPIComponentEngine)
- ENDIF()
+# MPI specific targets:
+IF(SALOME_USE_MPI)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ SalomeMPIContainer SalomeTestMPIComponentEngine)
+ENDIF()
- # Test targets:
- IF(SALOME_BUILD_TESTS)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets SALOMELocalTraceTest UnitTests)
- IF(NOT SALOME_LIGHT_ONLY)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets
- SALOMETraceCollectorTest UtilsTest NamingServiceTest SalomeTestComponentEngine
- LifeCycleCORBATest SalomeKernelHelpersTest SALOMEDSImplTest SALOMEDSTest)
- ENDIF()
+# Test targets:
+IF(SALOME_BUILD_TESTS)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets SALOMELocalTraceTest UnitTests)
+ IF(NOT SALOME_LIGHT_ONLY)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ SALOMETraceCollectorTest UtilsTest NamingServiceTest SalomeTestComponentEngine
+ LifeCycleCORBATest SalomeKernelHelpersTest SALOMEDSImplTest SALOMEDSTest)
ENDIF()
+ENDIF()
- # PACO specific targets:
- IF(SALOME_PACO_PARALLEL)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomeParallelContainer)
- ENDIF()
+# PACO specific targets:
+IF(SALOME_PACO_PARALLEL)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomeParallelContainer)
ENDIF()
IF(NOT SALOME_LIGHT_ONLY)
SALOME_CONFIGURE_FILE(CatalogResources.xml.in CatalogResources.xml INSTALL ${SALOME_KERNEL_INSTALL_RES_DATA})
-IF(NOT SALOME_LAUNCHER_ONLY)
- INSTALL(FILES channel.cfg SALOMEDS_Resources DESTINATION ${SALOME_KERNEL_INSTALL_RES_DATA})
- SALOME_CONFIGURE_FILE(KERNELCatalog.xml.in KERNELCatalog.xml INSTALL ${SALOME_KERNEL_INSTALL_RES_DATA})
-ENDIF()
+INSTALL(FILES channel.cfg SALOMEDS_Resources DESTINATION ${SALOME_KERNEL_INSTALL_RES_DATA})
+SALOME_CONFIGURE_FILE(KERNELCatalog.xml.in KERNELCatalog.xml INSTALL ${SALOME_KERNEL_INSTALL_RES_DATA})
)
SET(SUBDIR_CPPUNIT_GENERAL UnitTests)
-IF(SALOME_LAUNCHER_ONLY)
- SET(SUBDIRS Basics ResourcesManager Launcher)
-ELSE()
- SET(SUBDIRS ${SUBDIR_BASE})
- IF(NOT SALOME_LIGHT_ONLY)
- LIST(APPEND SUBDIRS ${SUBDIR_CORBA})
- ENDIF()
+SET(SUBDIRS ${SUBDIR_BASE})
+IF(NOT SALOME_LIGHT_ONLY)
+ LIST(APPEND SUBDIRS ${SUBDIR_CORBA})
+ENDIF()
- IF(SALOME_USE_MPI)
- LIST(APPEND SUBDIRS ${SUBDIR_MPI})
- ENDIF(SALOME_USE_MPI)
+IF(SALOME_USE_MPI)
+ LIST(APPEND SUBDIRS ${SUBDIR_MPI})
+ENDIF(SALOME_USE_MPI)
- IF(SALOME_BUILD_TESTS)
- LIST(APPEND SUBDIRS ${SUBDIR_CPPUNIT_BASE} ${SUBDIR_CPPUNIT_GENERAL})
- IF(NOT SALOME_LIGHT_ONLY)
- LIST(APPEND SUBDIRS ${SUBDIR_CPPUNIT_CORBA})
- ENDIF()
+IF(SALOME_BUILD_TESTS)
+ LIST(APPEND SUBDIRS ${SUBDIR_CPPUNIT_BASE} ${SUBDIR_CPPUNIT_GENERAL})
+ IF(NOT SALOME_LIGHT_ONLY)
+ LIST(APPEND SUBDIRS ${SUBDIR_CPPUNIT_CORBA})
ENDIF()
+ENDIF()
- IF(SALOME_PACO_PARALLEL)
- LIST(APPEND SUBDIRS ${SUBDIR_PARALLEL})
- ENDIF()
+IF(SALOME_PACO_PARALLEL)
+ LIST(APPEND SUBDIRS ${SUBDIR_PARALLEL})
ENDIF()
# For salome test
FOREACH(_dir ${SUBDIRS})
ADD_SUBDIRECTORY(${_dir})
-ENDFOREACH()
\ No newline at end of file
+ENDFOREACH()
${OMNIORB_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
- ${MPI_CXX_INCLUDE_PATH}
${LIBBATCH_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/salome_adm
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${PROJECT_BINARY_DIR}/idl
)
-ADD_DEFINITIONS(${MPI_DEFINITIONS} ${LIBXML2_DEFINITIONS} ${OMNIORB_DEFINITIONS})
+ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${OMNIORB_DEFINITIONS})
IF(SALOME_USE_LIBBATCH)
ADD_DEFINITIONS(-DWITH_LIBBATCH)
ENDIF(SALOME_USE_LIBBATCH)
SALOMEBasics
SalomeIDLKernel
${LIBBATCH_LIBRARIES}
- ${MPI_CXX_LIBRARIES}
${OMNIORB_LIBRARIES}
${LIBXML2_LIBRARIES}
${PYTHON_LIBRARIES}
)
ADD_LIBRARY(Launcher ${Launcher_SOURCES})
-TARGET_LINK_LIBRARIES(Launcher ResourcesManager ${LIBBATCH_LIBRARIES} ${MPI_CXX_LIBRARIES} ${LIBXML2_LIBS})
+TARGET_LINK_LIBRARIES(Launcher ResourcesManager ${LIBBATCH_LIBRARIES} ${LIBXML2_LIBS})
INSTALL(TARGETS Launcher EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
SET(TestLauncher_LIBS
${LIBXML2_LIBRARIES}
ResourcesManager
Launcher
- OpUtil
${LIBBATCH_LIBRARIES}
)
+# TestLauncher needs only (and must need only) libxml, libbatch, ResourceManager and Launcher libraries!
ADD_EXECUTABLE(TestLauncher TestLauncher.cxx)
TARGET_LINK_LIBRARIES(TestLauncher ${TestLauncher_LIBS})
INSTALL(TARGETS TestLauncher DESTINATION ${SALOME_INSTALL_BINS})
-IF(NOT SALOME_LAUNCHER_ONLY)
- ADD_LIBRARY(SalomeLauncher BatchTest.cxx SALOME_Launcher.cxx)
- TARGET_LINK_LIBRARIES(SalomeLauncher Launcher ${COMMON_LIBS})
- INSTALL(TARGETS SalomeLauncher EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+ADD_LIBRARY(SalomeLauncher BatchTest.cxx SALOME_Launcher.cxx)
+TARGET_LINK_LIBRARIES(SalomeLauncher Launcher ${COMMON_LIBS})
+INSTALL(TARGETS SalomeLauncher EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
- SET(SALOME_LauncherServer_LIBS
- Launcher
- SalomeLauncher
- SalomeSDS
- SALOMEBasics
- SALOMELocalTrace
- ${LIBBATCH_LIBRARIES}
- ${MPI_CXX_LIBRARIES}
- ${OMNIORB_LIBRARIES}
- ${LIBXML2_LIBRARIES}
- ${PYTHON_LIBRARIES}
- )
+SET(SALOME_LauncherServer_LIBS
+ Launcher
+ SalomeLauncher
+ SalomeSDS
+ SALOMEBasics
+ SALOMELocalTrace
+ ${LIBBATCH_LIBRARIES}
+ ${OMNIORB_LIBRARIES}
+ ${LIBXML2_LIBRARIES}
+ ${PYTHON_LIBRARIES}
+)
- ADD_EXECUTABLE(SALOME_LauncherServer SALOME_LauncherServer.cxx)
- TARGET_LINK_LIBRARIES(SALOME_LauncherServer ${SALOME_LauncherServer_LIBS})
- INSTALL(TARGETS SALOME_LauncherServer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
-ENDIF()
+ADD_EXECUTABLE(SALOME_LauncherServer SALOME_LauncherServer.cxx)
+TARGET_LINK_LIBRARIES(SALOME_LauncherServer ${SALOME_LauncherServer_LIBS})
+INSTALL(TARGETS SALOME_LauncherServer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
SET(COMMON_HEADERS_HXX
BatchTest.hxx
SALOME_Launcher_defs.hxx
)
INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
+INSTALL(FILES testLauncher.xml DESTINATION ${SALOME_KERNEL_INSTALL_RES_DATA})
//
#include "Launcher.hxx"
+#include <iostream>
+#include <string>
int main(int argc, char** argv)
{
+ std::string xmlfile("");
try {
Launcher_cpp *lcpp = new Launcher_cpp();
ResourcesManager_cpp *rcpp = new ResourcesManager_cpp();
lcpp->SetResourcesManager(rcpp);
+ if(!getenv("KERNEL_ROOT_DIR"))
+ throw ResourcesException("you must define KERNEL_ROOT_DIR environment variable!! -> cannot load testLauncher.xml");
+ xmlfile = getenv("KERNEL_ROOT_DIR");
+ xmlfile += "/share/salome/resources/kernel/testLauncher.xml";
+
+ long jobid = lcpp->createJobWithFile(xmlfile.c_str(),"localhost");
+ lcpp->launchJob(jobid);
delete lcpp;
delete rcpp;
std::cout << "test OK" << std::endl;
--- /dev/null
+<main>
+ <machine-list>
+ <machine work-directory="/tmp/testLauncher">localhost</machine>
+ </machine-list>
+ <nb-processes>1</nb-processes>
+ <output-file>testLauncher.output</output-file>
+ <command>ls > testLauncher.output</command>
+</main>
+
+
ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${LIBXML2_DEFINITIONS})
ADD_LIBRARY(ResourcesManager ${ResourcesManager_SOURCES})
-TARGET_LINK_LIBRARIES(ResourcesManager SALOMEBasics OpUtil ${LIBXML2_LIBRARIES})
+TARGET_LINK_LIBRARIES(ResourcesManager SALOMEBasics ${LIBXML2_LIBRARIES})
INSTALL(TARGETS ResourcesManager EXPORT ${PROJECT_NAME}TargetGroup
DESTINATION ${SALOME_INSTALL_LIBS})
-IF(NOT SALOME_LAUNCHER_ONLY)
- SET(SalomeResourcesManager_SOURCES
- SALOME_ResourcesManager.cxx
- SALOME_ResourcesManager_Client.cxx
- SALOME_ResourcesManager_Common.cxx
- )
- ADD_LIBRARY(SalomeResourcesManager ${SalomeResourcesManager_SOURCES})
- TARGET_LINK_LIBRARIES(SalomeResourcesManager ResourcesManager ${COMMON_LIBS})
- INSTALL(TARGETS SalomeResourcesManager EXPORT ${PROJECT_NAME}TargetGroup
+SET(SalomeResourcesManager_SOURCES
+ SALOME_ResourcesManager.cxx
+ SALOME_ResourcesManager_Client.cxx
+ SALOME_ResourcesManager_Common.cxx
+)
+ADD_LIBRARY(SalomeResourcesManager ${SalomeResourcesManager_SOURCES})
+TARGET_LINK_LIBRARIES(SalomeResourcesManager ResourcesManager ${COMMON_LIBS})
+INSTALL(TARGETS SalomeResourcesManager EXPORT ${PROJECT_NAME}TargetGroup
DESTINATION ${SALOME_INSTALL_LIBS})
-ENDIF()
SET(COMMON_HEADERS_HXX
ResourcesManager.hxx
#include <algorithm>
-#include "Utils_SALOME_Exception.hxx"
-
#define MAX_SIZE_FOR_HOSTNAME 256;
using namespace std;
void
ResourcesManager_cpp::AddResourceInCatalog(const ParserResourcesType & new_resource)
{
- if (new_resource.Name == DEFAULT_RESOURCE_NAME)
- throw SALOME_Exception((string("Cannot modify default local resource \"") +
- DEFAULT_RESOURCE_NAME + "\"").c_str());
+ if (new_resource.Name == DEFAULT_RESOURCE_NAME){
+ std::string error("Cannot modify default local resource \"" + DEFAULT_RESOURCE_NAME + "\"");
+ throw ResourcesException(error);
+ }
// TODO - Add minimal check
_resourcesList[new_resource.Name] = new_resource;
}
void ResourcesManager_cpp::DeleteResourceInCatalog(const char * name)
{
- if (DEFAULT_RESOURCE_NAME == name)
- throw SALOME_Exception((string("Cannot delete default local resource \"") +
- DEFAULT_RESOURCE_NAME + "\"").c_str());
+ if (DEFAULT_RESOURCE_NAME == name){
+ std::string error("Cannot delete default local resource \"" + DEFAULT_RESOURCE_NAME + "\"");
+ throw ResourcesException(error);
+ }
MapOfParserResourcesType_it it = _resourcesList.find(name);
if (it != _resourcesList.end())
_resourcesList.erase(name);
std::vector<std::string> resourceList;
};
-class RESOURCESMANAGER_EXPORT ResourcesException
-{
-public:
- const std::string msg;
-
- ResourcesException(const std::string m) : msg(m) {}
-};
-
class RESOURCESMANAGER_EXPORT ResourcesManager_cpp
{
//
#include "SALOME_ResourcesCatalog_Handler.hxx"
#include "Basics_Utils.hxx"
-#include "Utils_SALOME_Exception.hxx"
#include <iostream>
#include <sstream>
#include <map>
{
resource.setAccessProtocolTypeStr((const char *)protocol);
}
- catch (const SALOME_Exception & e)
+ catch (const ResourcesException & e)
{
std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
{
resource.setClusterInternalProtocolStr((const char *)iprotocol);
}
- catch (const SALOME_Exception & e)
+ catch (const ResourcesException & e)
{
std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
{
resource.setResourceTypeStr((const char*)type);
}
- catch (const SALOME_Exception & e)
+ catch (const ResourcesException & e)
{
cerr << "Warning, invalid type \"" << (const char*)type << "\" for resource \"" <<
resource.Name << "\", using default value \"" << resource.getResourceTypeStr() <<
{
resource.setAccessProtocolTypeStr((const char *)protocol);
}
- catch (const SALOME_Exception & e)
+ catch (const ResourcesException & e)
{
cerr << "Warning, invalid protocol \"" << (const char*)protocol << "\" for resource \"" <<
resource.Name << "\", using default value \"" <<
{
resource.setClusterInternalProtocolStr((const char *)iprotocol);
}
- catch (const SALOME_Exception & e)
+ catch (const ResourcesException & e)
{
cerr << "Warning, invalid internal protocol \"" << (const char*)iprotocol <<
"\" for resource \"" << resource.Name << "\", using default value \"" <<
{
resource.setBatchTypeStr((const char *)batch);
}
- catch (const SALOME_Exception & e)
+ catch (const ResourcesException & e)
{
cerr << "Warning, invalid batch manager \"" << (const char*)batch <<
"\" for resource \"" << resource.Name << "\", using default value \"" <<
{
resource.setMpiImplTypeStr((const char *)mpi);
}
- catch (const SALOME_Exception & e)
+ catch (const ResourcesException & e)
{
cerr << "Warning, invalid MPI implementation \"" << (const char*)mpi <<
"\" for resource \"" << resource.Name << "\", using default value \"" <<
{
resource.setCanLaunchBatchJobsStr((const char *)can_launch_batch_jobs);
}
- catch (const SALOME_Exception & e)
+ catch (const ResourcesException & e)
{
cerr << "Warning, invalid can_launch_batch_jobs parameter value \"" <<
(const char*)can_launch_batch_jobs << "\" for resource \"" << resource.Name <<
{
resource.setCanRunContainersStr((const char *)can_run_containers);
}
- catch (const SALOME_Exception & e)
+ catch (const ResourcesException & e)
{
cerr << "Warning, invalid can_run_containers parameter value \"" <<
(const char*)can_run_containers << "\" for resource \"" << resource.Name <<
//
#include "SALOME_ResourcesCatalog_Parser.hxx"
-#include "Utils_SALOME_Exception.hxx"
#include <iostream>
#include <sstream>
case blaunch:
return "blaunch";
default:
- throw SALOME_Exception("Unknown protocol");
+ throw ResourcesException("Unknown protocol");
}
}
else if (protocolStr == "blaunch")
return blaunch;
else
- throw SALOME_Exception((string("Unknown protocol ") + protocolStr).c_str());
+ throw ResourcesException((string("Unknown protocol ") + protocolStr).c_str());
}
ostream & operator<<(ostream &os, const ParserResourcesType &prt)
case single_machine:
return "single_machine";
default:
- throw SALOME_Exception("Unknown resource type");
+ throw ResourcesException("Unknown resource type");
}
}
case coorm:
return "coorm";
default:
- throw SALOME_Exception("Unknown batch type");
+ throw ResourcesException("Unknown batch type");
}
}
case prun:
return "prun";
default:
- throw SALOME_Exception("Unknown MPI implementation type");
+ throw ResourcesException("Unknown MPI implementation type");
}
}
else if (resourceTypeStr == "single_machine")
type = single_machine;
else
- throw SALOME_Exception((string("Unknown resource type ") + resourceTypeStr).c_str());
+ throw ResourcesException((string("Unknown resource type ") + resourceTypeStr).c_str());
}
void ParserResourcesType::setBatchTypeStr(const string & batchTypeStr)
else if (batchTypeStr == "" || batchTypeStr == "none" || batchTypeStr == "ssh_batch")
Batch = none;
else
- throw SALOME_Exception((string("Unknown batch type ") + batchTypeStr).c_str());
+ throw ResourcesException((string("Unknown batch type ") + batchTypeStr).c_str());
}
void ParserResourcesType::setMpiImplTypeStr(const string & mpiImplTypeStr)
else if (mpiImplTypeStr == "" || mpiImplTypeStr == "no mpi")
mpi = nompi;
else
- throw SALOME_Exception((string("Unknown MPI implementation type ") + mpiImplTypeStr).c_str());
+ throw ResourcesException((string("Unknown MPI implementation type ") + mpiImplTypeStr).c_str());
}
void ParserResourcesType::setClusterInternalProtocolStr(const string & internalProtocolTypeStr)
else if (canLaunchBatchJobsStr == "false")
can_launch_batch_jobs = false;
else
- throw SALOME_Exception((string("Invalid boolean value for can_launch_batch_jobs: ") +
+ throw ResourcesException((string("Invalid boolean value for can_launch_batch_jobs: ") +
canLaunchBatchJobsStr).c_str());
}
else if (canRunContainersStr == "false")
can_run_containers = false;
else
- throw SALOME_Exception((string("Invalid boolean value for can_run_containers: ") +
+ throw ResourcesException((string("Invalid boolean value for can_run_containers: ") +
canRunContainersStr).c_str());
}
enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, ompi, slurmmpi, prun};
+class RESOURCESMANAGER_EXPORT ResourcesException
+{
+public:
+ const std::string msg;
+
+ ResourcesException(const std::string m) : msg(m) {}
+};
+
class RESOURCESMANAGER_EXPORT ResourceDataToSort
{