From b985753623c85ce1d65a0cadd3e942868349ef1b Mon Sep 17 00:00:00 2001 From: barate Date: Mon, 28 Jan 2013 09:57:45 +0000 Subject: [PATCH] - Delete deprecated structures MachineParameters and RessourcesCatalog - Split file SALOME_ContainerManager.idl in three --- idl/CMakeLists.txt | 3 +- idl/Makefile.am | 8 +- idl/SALOME_ContainerManager.idl | 269 +----------------- idl/SALOME_Launcher.idl | 131 +++++++++ idl/SALOME_ResourcesManager.idl | 163 +++++++++++ idl/SALOME_RessourcesCatalog.idl | 90 ------ src/KernelHelpers/SALOME_KernelServices.hxx | 2 +- src/Launcher/SALOME_Launcher.hxx | 2 +- .../SALOME_FileTransferCORBA.cxx | 11 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 173 ++--------- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx | 20 +- .../Test/LifeCycleCORBATest.cxx | 16 +- src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py | 26 +- src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py | 26 +- .../libSALOME_LifeCycleCORBA.i | 41 +-- src/NamingService/SALOME_NamingService.cxx | 55 +--- src/NamingService/SALOME_NamingService.hxx | 5 - src/NamingService/Test/CMakeLists.txt | 2 + src/NamingService/Test/Makefile.am | 5 +- src/NamingService/Test/NamingServiceTest.cxx | 23 +- 20 files changed, 411 insertions(+), 660 deletions(-) create mode 100644 idl/SALOME_Launcher.idl create mode 100644 idl/SALOME_ResourcesManager.idl delete mode 100755 idl/SALOME_RessourcesCatalog.idl diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index 8dc0b75a9..b2d2a17f7 100755 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -30,7 +30,8 @@ SET(SalomeIDLKernel_IDLSOURCES SALOME_Exception.idl SALOME_Comm.idl SALOME_ModuleCatalog.idl - SALOME_RessourcesCatalog.idl + SALOME_ResourcesManager.idl + SALOME_Launcher.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl diff --git a/idl/Makefile.am b/idl/Makefile.am index cf953c8e7..13d4db038 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -33,7 +33,8 @@ BASEIDL_FILES = \ SALOME_Exception.idl \ SALOME_Comm.idl \ SALOME_ModuleCatalog.idl \ - SALOME_RessourcesCatalog.idl \ + SALOME_ResourcesManager.idl \ + SALOME_Launcher.idl \ SALOMEDS.idl \ SALOMEDS_Attributes.idl \ SALOME_Component.idl \ @@ -86,7 +87,8 @@ BASEIDL_SOURCES =\ SALOME_ExceptionSK.cc \ SALOME_CommSK.cc \ SALOME_ModuleCatalogSK.cc \ - SALOME_RessourcesCatalogSK.cc \ + SALOME_ResourcesManagerSK.cc \ + SALOME_LauncherSK.cc \ SALOMEDSSK.cc \ SALOMEDS_AttributesSK.cc \ SALOME_ComponentSK.cc \ @@ -112,7 +114,7 @@ BASEIDL_SOURCES =\ DYNIDL_SRCS = \ SALOME_PortsDynSK.cc Calcium_PortsDynSK.cc SALOME_ContainerManagerDynSK.cc \ SALOME_CommDynSK.cc SALOME_RegistryDynSK.cc SALOME_ModuleCatalogDynSK.cc \ - SALOMEDSDynSK.cc SALOME_SessionDynSK.cc SALOME_RessourcesCatalogDynSK.cc \ + SALOMEDSDynSK.cc SALOME_SessionDynSK.cc SALOME_ResourcesManagerDynSK.cc SALOME_LauncherDynSK.cc \ DSC_EnginesDynSK.cc SALOME_ComponentDynSK.cc SALOME_GenericObjDynSK.cc SALOME_TypesDynSK.cc \ Palm_PortsDynSK.cc SALOME_ExceptionDynSK.cc SALOMEDS_AttributesDynSK.cc \ LoggerDynSK.cc SALOME_PACOExtensionDynSK.cc SALOME_ParamPortsDynSK.cc SALOME_PyNodeDynSK.cc \ diff --git a/idl/SALOME_ContainerManager.idl b/idl/SALOME_ContainerManager.idl index 7b452ee04..27e34a110 100644 --- a/idl/SALOME_ContainerManager.idl +++ b/idl/SALOME_ContainerManager.idl @@ -25,67 +25,14 @@ #include "SALOME_Exception.idl" #include "SALOME_Component.idl" +#include "SALOME_ResourcesManager.idl" -/*! \file SALOME_ContainerManager.idl \brief interfaces for %SALOME launcher and container manager +/*! \file SALOME_ContainerManager.idl \brief interfaces for %SALOME Container Manager service */ module Engines { -//! Type to transmit list of resources. -typedef sequence ResourceList; -//! components list -typedef sequence CompoList; -//! files list -typedef sequence FilesList; -//! modules list -typedef sequence ModulesList; - -//! A generic parameter -struct Parameter -{ - string name; - string value; -}; -//! Generic parameter list -typedef sequence ParameterList; - -//! Type to describe required properties of a resource -struct ResourceParameters -{ - //! resource name - manual selection - string name; - //! host name - string hostname; - //! if true select only resources that can launch batch jobs - boolean can_launch_batch_jobs; - //! if true select only resources that can run containers - boolean can_run_containers; - //! if given required operating system - string OS; - //! if given list of components that could be loaded on a container - //! Optional if no resource are found with this constraint - CompoList componentList; - - // Permits to order resources - //! required number of proc - long nb_proc; - //! required memory size - long mem_mb; - //! required frequency - long cpu_clock; - //! required number of node - long nb_node; - //! required number of proc per node - long nb_proc_per_node; - - // Permits to configure SALOME resource management - //! resource management policy : first, cycl, altcycl or best (can be extended) - string policy; - //! restricted list of resources to search in - ResourceList resList; -}; - //! Type to describe required properties of a container struct ContainerParameters { @@ -114,137 +61,6 @@ struct ContainerParameters ResourceParameters resource_params; }; -//! Type to describe a resource -struct ResourceDefinition -{ - //! name - string name; - //! hostname - string hostname; - //! Type of the resource ("cluster" or "single_machine") - string type; - //! protocol to connect to the resource - //! protocol used to start a remote container (ssh or rsh) - string protocol; - //! login name to use to start a remote container - string username; - //! salome application to use to start a remote container - string applipath; - //! list of available components - CompoList componentList; - - //! operating system - string OS; - //! memory size per node - long mem_mb; - //! frequency - long cpu_clock; - //! number of node - long nb_node; - //! number of proc per node - long nb_proc_per_node; - //! batch system - string batch; - //! MPI implementation - string mpiImpl; - //! if the resource is a cluster: - //! internal protocol to use to start a remote container (ssh or rsh) on the cluster - string iprotocol; - - //! Specify if the resource can launch batch jobs - boolean can_launch_batch_jobs; - //! Specify if the resource can run containers - boolean can_run_containers; - - //! Predefined working directory on the resource - string working_directory; -}; - -//! exception thrown if a computer is not found in the catalog -exception NotFound {}; - -struct JobParameters -{ - string job_name; - //! Job Type - Could be equal to "command" or "yacs_file" or "python_salome" - string job_type; - - // Common values - string job_file; - string env_file; - FilesList in_files; - FilesList out_files; - string work_directory; - string local_directory; - string result_directory; - - /*! Time for the batch (has to be like this : hh:mm) - Could be empty, in - this case, default value of the selected resource will be used. - */ - string maximum_duration; - - // Memory is expressed in megabytes -> mem_mb - // Number of Processors -> nb_proc - ResourceParameters resource_required; - - /*! - Name of the batch queue choosed - optional - */ - string queue; - - /*! - Specific parameters for each type of job - optional - */ - Engines::ParameterList specific_parameters; -}; - -struct JobDescription -{ - long job_id; - Engines::JobParameters job_parameters; -}; -typedef sequence JobsList; - -interface SalomeLauncherObserver -{ - void notify(in string event_name, in string event_data); -}; - -/*! \brief Interface of the %salomelauncher - This interface is used for interaction with the unique instance - of SalomeLauncher -*/ -interface SalomeLauncher -{ - // Main methods - long createJob (in Engines::JobParameters job_parameters) raises (SALOME::SALOME_Exception); - void launchJob (in long job_id) raises (SALOME::SALOME_Exception); - string getJobState (in long job_id) raises (SALOME::SALOME_Exception); - void getJobResults(in long job_id, in string directory) raises (SALOME::SALOME_Exception); - boolean getJobDumpState(in long job_id, in string directory) raises (SALOME::SALOME_Exception); - void stopJob (in long job_id) raises (SALOME::SALOME_Exception); - void removeJob (in long job_id) raises (SALOME::SALOME_Exception); - - // Useful methods - long createJobWithFile(in string xmlJobFile, in string clusterName) raises (SALOME::SALOME_Exception); - boolean testBatch (in ResourceParameters params) raises (SALOME::SALOME_Exception); - - // SALOME kernel service methods - void Shutdown(); - long getPID(); - - // Observer and introspection methods - void addObserver(in Engines::SalomeLauncherObserver observer); - void removeObserver(in Engines::SalomeLauncherObserver observer); - Engines::JobsList getJobsList(); - Engines::JobParameters getJobParameters(in long job_id) raises (SALOME::SALOME_Exception); - - // Save and load methods - void loadJobs(in string jobs_file) raises (SALOME::SALOME_Exception); - void saveJobs(in string jobs_file) raises (SALOME::SALOME_Exception); - -}; - /*! \brief Interface of the %containerManager This interface is used for interaction with the unique instance of ContainerManager @@ -259,88 +75,7 @@ interface ContainerManager //! Shutdown all containers that have been launched by the container manager void ShutdownContainers(); } ; - -/*! \brief Interface of the %resourcesManager - This interface is used for interaction with the unique instance - of ResourcesManager -*/ -interface ResourcesManager -{ - //! Find first available resource in a resources list - string FindFirst(in ResourceList possibleResources); - - //! Find best available computer according to policy in a computers list - string Find(in string policy, in ResourceList possibleResources); - - //! Get a list of resources that are best suited to launch a container given constraints - /*! - The constraints are resource constraints (params) and components constraints (componentList) - */ - ResourceList GetFittingResources(in ResourceParameters params) raises (SALOME::SALOME_Exception); - - //! Get definition of a resource - ResourceDefinition GetResourceDefinition(in string name) raises (SALOME::SALOME_Exception); - - //! Add a new resource to the resource_manager - /*! - write -> true, resource manager will add it into a xml_file - xml_file -> could be empty, in this case if write is true, resource manager will write - the resource in its first ResourceCatalog file - */ - void AddResource(in ResourceDefinition new_resource, in boolean write, in string xml_file) - raises (SALOME::SALOME_Exception); - - //! Remove a new resource to the resource_manager - /*! - write -> true, resource manager will write a new xml_file - xml_file -> could be empty, in this case if write is true, resource manager will write - the resource in its first ResourceCatalog file - */ - void RemoveResource(in string resource_name, in boolean write, in string xml_file) - raises (SALOME::SALOME_Exception); -}; - -// For compatibility - will be erased on SALOME 6 -typedef sequence MachineList; -//! Type to describe required properties of a container. -struct MachineParameters -{ - //! container name if given else automatic - string container_name; - //! host name if given else automatic - string hostname; - //! if given list of components that could be loaded on the container - CompoList componentList; - //! if given restricted list of machines to search in - MachineList computerList; - //! required operating system - string OS; - //! required memory size - long mem_mb; - //! required frequency - long cpu_clock; - //! required number of proc per node - long nb_proc_per_node; - //! required number of node - long nb_node; - //! if true start a MPI container - boolean isMPI; - //! container working directory - string workingdir; - //! creation mode for GiveContainer. - /*!start creates a new container - * get try to find an existing container - * getorstart use an existing container if it exists or creates a new one - */ - string mode; - //! resource management policy : first, cycl, altcycl or best (can be extended) - string policy; - - //! PaCO specific informations - string parallelLib; - long nb_component_nodes; -}; }; #endif diff --git a/idl/SALOME_Launcher.idl b/idl/SALOME_Launcher.idl new file mode 100644 index 000000000..8b72b422c --- /dev/null +++ b/idl/SALOME_Launcher.idl @@ -0,0 +1,131 @@ +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _SALOME_LAUNCHER_IDL_ +#define _SALOME_LAUNCHER_IDL_ + +#include "SALOME_Exception.idl" +#include "SALOME_ResourcesManager.idl" + +/*! \file SALOME_Launcher.idl \brief interfaces for %SALOME Launcher service +*/ + +module Engines +{ + +//! files list +typedef sequence FilesList; + +//! A generic parameter +struct Parameter +{ + string name; + string value; +}; +//! Generic parameter list +typedef sequence ParameterList; + +struct JobParameters +{ + string job_name; + //! Job Type - Could be equal to "command" or "yacs_file" or "python_salome" + string job_type; + + // Common values + string job_file; + string env_file; + FilesList in_files; + FilesList out_files; + string work_directory; + string local_directory; + string result_directory; + + /*! Time for the batch (has to be like this : hh:mm) - Could be empty, in + this case, default value of the selected resource will be used. + */ + string maximum_duration; + + // Memory is expressed in megabytes -> mem_mb + // Number of Processors -> nb_proc + ResourceParameters resource_required; + + /*! + Name of the batch queue choosed - optional + */ + string queue; + + /*! + Specific parameters for each type of job - optional + */ + Engines::ParameterList specific_parameters; +}; + +struct JobDescription +{ + long job_id; + Engines::JobParameters job_parameters; +}; +typedef sequence JobsList; + +interface SalomeLauncherObserver +{ + void notify(in string event_name, in string event_data); +}; + +/*! \brief Interface of the %salomelauncher + This interface is used for interaction with the unique instance + of SalomeLauncher +*/ +interface SalomeLauncher +{ + // Main methods + long createJob (in Engines::JobParameters job_parameters) raises (SALOME::SALOME_Exception); + void launchJob (in long job_id) raises (SALOME::SALOME_Exception); + string getJobState (in long job_id) raises (SALOME::SALOME_Exception); + void getJobResults(in long job_id, in string directory) raises (SALOME::SALOME_Exception); + boolean getJobDumpState(in long job_id, in string directory) raises (SALOME::SALOME_Exception); + void stopJob (in long job_id) raises (SALOME::SALOME_Exception); + void removeJob (in long job_id) raises (SALOME::SALOME_Exception); + + // Useful methods + long createJobWithFile(in string xmlJobFile, in string clusterName) raises (SALOME::SALOME_Exception); + boolean testBatch (in ResourceParameters params) raises (SALOME::SALOME_Exception); + + // SALOME kernel service methods + void Shutdown(); + long getPID(); + + // Observer and introspection methods + void addObserver(in Engines::SalomeLauncherObserver observer); + void removeObserver(in Engines::SalomeLauncherObserver observer); + Engines::JobsList getJobsList(); + Engines::JobParameters getJobParameters(in long job_id) raises (SALOME::SALOME_Exception); + + // Save and load methods + void loadJobs(in string jobs_file) raises (SALOME::SALOME_Exception); + void saveJobs(in string jobs_file) raises (SALOME::SALOME_Exception); + +}; + +}; + +#endif diff --git a/idl/SALOME_ResourcesManager.idl b/idl/SALOME_ResourcesManager.idl new file mode 100644 index 000000000..a43f9e815 --- /dev/null +++ b/idl/SALOME_ResourcesManager.idl @@ -0,0 +1,163 @@ +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _SALOME_RESOURCESMANAGER_IDL_ +#define _SALOME_RESOURCESMANAGER_IDL_ + +#include "SALOME_Exception.idl" + +/*! \file SALOME_ResourcesManager.idl \brief interfaces for %SALOME Resources Manager service +*/ + +module Engines +{ + +//! Type to transmit list of resources. +typedef sequence ResourceList; +//! components list +typedef sequence CompoList; + +//! Type to describe required properties of a resource +struct ResourceParameters +{ + //! resource name - manual selection + string name; + //! host name + string hostname; + //! if true select only resources that can launch batch jobs + boolean can_launch_batch_jobs; + //! if true select only resources that can run containers + boolean can_run_containers; + //! if given required operating system + string OS; + //! if given list of components that could be loaded on a container + //! Optional if no resource are found with this constraint + CompoList componentList; + + // Permits to order resources + //! required number of proc + long nb_proc; + //! required memory size + long mem_mb; + //! required frequency + long cpu_clock; + //! required number of node + long nb_node; + //! required number of proc per node + long nb_proc_per_node; + + // Permits to configure SALOME resource management + //! resource management policy : first, cycl, altcycl or best (can be extended) + string policy; + //! restricted list of resources to search in + ResourceList resList; +}; + +//! Type to describe a resource +struct ResourceDefinition +{ + //! name + string name; + //! hostname + string hostname; + //! Type of the resource ("cluster" or "single_machine") + string type; + //! protocol to connect to the resource + //! protocol used to start a remote container (ssh or rsh) + string protocol; + //! login name to use to start a remote container + string username; + //! salome application to use to start a remote container + string applipath; + //! list of available components + CompoList componentList; + + //! operating system + string OS; + //! memory size per node + long mem_mb; + //! frequency + long cpu_clock; + //! number of node + long nb_node; + //! number of proc per node + long nb_proc_per_node; + //! batch system + string batch; + //! MPI implementation + string mpiImpl; + //! if the resource is a cluster: + //! internal protocol to use to start a remote container (ssh or rsh) on the cluster + string iprotocol; + + //! Specify if the resource can launch batch jobs + boolean can_launch_batch_jobs; + //! Specify if the resource can run containers + boolean can_run_containers; + + //! Predefined working directory on the resource + string working_directory; +}; + +/*! \brief Interface of the %resourcesManager + This interface is used for interaction with the unique instance + of ResourcesManager +*/ +interface ResourcesManager +{ + //! Find first available resource in a resources list + string FindFirst(in ResourceList possibleResources); + + //! Find best available computer according to policy in a computers list + string Find(in string policy, in ResourceList possibleResources); + + //! Get a list of resources that are best suited to launch a container given constraints + /*! + The constraints are resource constraints (params) and components constraints (componentList) + */ + ResourceList GetFittingResources(in ResourceParameters params) raises (SALOME::SALOME_Exception); + + //! Get definition of a resource + ResourceDefinition GetResourceDefinition(in string name) raises (SALOME::SALOME_Exception); + + //! Add a new resource to the resource_manager + /*! + write -> true, resource manager will add it into a xml_file + xml_file -> could be empty, in this case if write is true, resource manager will write + the resource in its first ResourceCatalog file + */ + void AddResource(in ResourceDefinition new_resource, in boolean write, in string xml_file) + raises (SALOME::SALOME_Exception); + + //! Remove a new resource to the resource_manager + /*! + write -> true, resource manager will write a new xml_file + xml_file -> could be empty, in this case if write is true, resource manager will write + the resource in its first ResourceCatalog file + */ + void RemoveResource(in string resource_name, in boolean write, in string xml_file) + raises (SALOME::SALOME_Exception); +}; + +}; + +#endif diff --git a/idl/SALOME_RessourcesCatalog.idl b/idl/SALOME_RessourcesCatalog.idl deleted file mode 100755 index ff254ef94..000000000 --- a/idl/SALOME_RessourcesCatalog.idl +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -// File : SALOME_RessourcesCatalog.idl -// Author : Estelle Deville -// $Header$ -// -/*! \file SALOME_RessourcesCatalog.idl \brief interfaces for %SALOME Resources Catalog -*/ - -/*! \brief module that provides interface to manage the Resources Catalog of %SALOME -*/ -module SALOME_RessourcesCatalog{ - - //! Information about a processor - struct proc_info{ - //! processor number - long number; - //! model name - string model_name; - //! frequency in MHz - float cpu_mhz; - //! cache size in MB - float cache_size; - }; - - //! a list of processor informations - typedef sequence ListOfProc; - - //! Information about a computer - /*! - Os and informations about processors - */ - struct computer_info{ - //! computer name - string name; - //! OS name - string OS; - //! OS version - string OS_version; - //! processors list - ListOfProc procs; - }; - - //! Container type - enum ContainerType { - Cpp, /*!< C++ container */ - python, /*!< python container */ - NP /*!< NP container */ - }; - //! a list of container types - typedef sequence ListOfContainerType; - - //! a list of computer names - typedef sequence ListOfComputer; - - //! exception thrown if a computer is not found in the catalog - exception NotFound {}; - - //------------------------------------------------------------------ -/*! \brief interface to get information about Resources -*/ - interface RessourcesCatalog { - //! Get the catalog computers list - ListOfComputer GetComputerList(); - //! Get the container types list for a given computer - ListOfContainerType GetContainerTypeList (in string computer) raises(NotFound); - //! Get computer information for a given computer - computer_info GetComputerInfo(in string computer) raises(NotFound); - }; -}; diff --git a/src/KernelHelpers/SALOME_KernelServices.hxx b/src/KernelHelpers/SALOME_KernelServices.hxx index 4970858cf..15a79ac56 100644 --- a/src/KernelHelpers/SALOME_KernelServices.hxx +++ b/src/KernelHelpers/SALOME_KernelServices.hxx @@ -26,7 +26,7 @@ #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -#include CORBA_SERVER_HEADER(SALOME_ContainerManager) +#include CORBA_SERVER_HEADER(SALOME_Launcher) #include CORBA_CLIENT_HEADER(SALOME_Session) #include CORBA_SERVER_HEADER(SALOME_Exception) diff --git a/src/Launcher/SALOME_Launcher.hxx b/src/Launcher/SALOME_Launcher.hxx index f33466fe5..8e3df22f3 100644 --- a/src/Launcher/SALOME_Launcher.hxx +++ b/src/Launcher/SALOME_Launcher.hxx @@ -26,7 +26,7 @@ #include "SALOME_Launcher_defs.hxx" #include -#include CORBA_CLIENT_HEADER(SALOME_ContainerManager) +#include CORBA_CLIENT_HEADER(SALOME_Launcher) #include "Launcher.hxx" #include diff --git a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx index fce9c4905..73ae4bac9 100644 --- a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx @@ -125,15 +125,12 @@ std::string SALOME_FileTransferCORBA::getLocalFile(std::string localFile) Engines::ContainerManager_var contManager = LCC.getContainerManager(); Engines::ResourcesManager_var resManager = LCC.getResourcesManager(); - Engines::MachineParameters params; + Engines::ContainerParameters params; LCC.preSet(params); params.container_name = _containerName.c_str(); - params.hostname = _refMachine.c_str(); - - Engines::ContainerParameters new_params; - LCC.convert(params, new_params); - new_params.mode = CORBA::string_dup("findorstart"); - container = contManager->GiveContainer(new_params); + params.resource_params.hostname = _refMachine.c_str(); + params.mode = CORBA::string_dup("findorstart"); + container = contManager->GiveContainer(params); if (CORBA::is_nil(container)) { INFOS("machine " << _refMachine << " unreachable"); diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 48987c754..7b341e213 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -48,6 +48,7 @@ #include CORBA_CLIENT_HEADER(SALOME_Registry) #include CORBA_CLIENT_HEADER(SALOMEDS) #include CORBA_CLIENT_HEADER(Logger) +#include CORBA_CLIENT_HEADER(SALOME_Launcher) #include "SALOME_ContainerManager.hxx" #include "SALOME_Component_i.hxx" @@ -124,22 +125,21 @@ SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA() //============================================================================= /*! \brief Find an already existing and registered component instance. * - * \param params machine parameters like type or name... + * \param params container parameters like type or name... * \param componentName the name of component class * \param studyId default = 0 : multistudy instance * \return a CORBA reference of the component instance, or _nil if not found */ //============================================================================= Engines::EngineComponent_ptr -SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params, +SALOME_LifeCycleCORBA::FindComponent(const Engines::ContainerParameters& params, const char *componentName, int studyId) { if (! isKnownComponentClass(componentName)) return Engines::EngineComponent::_nil(); - Engines::ContainerParameters new_params; - convert(params, new_params); + Engines::ContainerParameters new_params(params); new_params.resource_params.componentList.length(1); new_params.resource_params.componentList[0] = componentName; new_params.resource_params.can_run_containers = true; @@ -162,9 +162,9 @@ SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params, } //============================================================================= -/*! \brief Load a component instance on a container defined by machine parameters +/*! \brief Load a component instance on a container defined by its parameters * - * \param params machine parameters like type or name... + * \param params container parameters like type or name... * \param componentName the name of component class * \param studyId default = 0 : multistudy instance * \return a CORBA reference of the component instance, or _nil if problem @@ -172,7 +172,7 @@ SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params, //============================================================================= Engines::EngineComponent_ptr -SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params, +SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params, const char *componentName, int studyId) { @@ -181,8 +181,7 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params, if (! isKnownComponentClass(componentName)) return Engines::EngineComponent::_nil(); - Engines::ContainerParameters new_params; - convert(params, new_params); + Engines::ContainerParameters new_params(params); new_params.resource_params.componentList.length(1); new_params.resource_params.componentList[0] = componentName; new_params.resource_params.can_run_containers = true; @@ -207,65 +206,15 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params, //============================================================================= /*! \brief Find an already existing and registered component instance or load a new - * component instance on a container defined by machine parameters. + * component instance on a container defined by its parameters. * - * \param params machine parameters like type or name... + * \param params container parameters like type or name... * \param componentName the name of component class * \param studyId default = 0 : multistudy instance * \return a CORBA reference of the component instance, or _nil if problem */ //============================================================================= -Engines::EngineComponent_ptr -SALOME_LifeCycleCORBA:: -FindOrLoad_Component(const Engines::MachineParameters& params, - const char *componentName, - int studyId) -{ - // --- Check if Component Name is known in ModuleCatalog - - if (! isKnownComponentClass(componentName)) - return Engines::EngineComponent::_nil(); - - Engines::ContainerParameters new_params; - convert(params, new_params); - new_params.resource_params.componentList.length(1); - new_params.resource_params.componentList[0] = componentName; - new_params.resource_params.can_run_containers = true; - - // For Compatibility -> if hostname == localhost put name == hostname - if (std::string(new_params.resource_params.hostname.in()) == "localhost") - { - new_params.resource_params.hostname = CORBA::string_dup(Kernel_Utils::GetHostname().c_str()); - new_params.resource_params.name = CORBA::string_dup("localhost"); - } - - Engines::ResourceList_var listOfResources; - try - { - listOfResources = _ResManager->GetFittingResources(new_params.resource_params); - } - catch( const SALOME::SALOME_Exception& ex ) - { - return Engines::EngineComponent::_nil(); - } - - Engines::EngineComponent_var compo = _FindComponent(new_params, - componentName, - studyId, - listOfResources); - - if(CORBA::is_nil(compo)) - { - new_params.resource_params.resList = listOfResources; - compo = _LoadComponent(new_params, - componentName, - studyId); - } - - return compo._retn(); -} - Engines::EngineComponent_ptr SALOME_LifeCycleCORBA:: FindOrLoad_Component(const Engines::ContainerParameters& params, @@ -335,22 +284,21 @@ SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName, std::string st2Container(stContainer); int rg=st2Container.find("/"); - Engines::MachineParameters_var params=new Engines::MachineParameters; + Engines::ContainerParameters params; preSet(params); if (rg<0) { // containerName doesn't contain "/" => Local container - params->container_name=CORBA::string_dup(stContainer); - params->hostname=""; + params.container_name = CORBA::string_dup(stContainer); } else { stContainer[rg]='\0'; - params->container_name=CORBA::string_dup(stContainer+rg+1); - params->hostname=CORBA::string_dup(stContainer); + params.container_name = CORBA::string_dup(stContainer+rg+1); + params.resource_params.hostname = CORBA::string_dup(stContainer); } - params->isMPI = false; - SCRUTE(params->container_name); + params.isMPI = false; + SCRUTE(params.container_name); free(stContainer); return FindOrLoad_Component(params, componentName); } @@ -392,54 +340,10 @@ bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName) } //============================================================================= -/*! - * Not so complex... useful ? +/*! \brief Initialisation of a given Engines::ResourceParameters with default values. */ //============================================================================= -bool -SALOME_LifeCycleCORBA::isMpiContainer(const Engines::ContainerParameters& params) - throw(IncompatibleComponent) -{ - if( params.isMPI ) - return true; - else - return false; -} - - -//============================================================================= -/*! \brief Initialisation of a given Engines::MachineParameters with default values. - * - * - container_name = "" : not relevant - * - hostname = "" : not relevant - * - OS = "" : not relevant - * - nb_proc = 0 : not relevant - * - mem_mb = 0 : not relevant - * - cpu_clock = 0 : not relevant - * - nb_proc_per_node = 0 : not relevant - * - nb_node = 0 : not relevant - * - isMPI = false : standard components - */ -//============================================================================= - -void SALOME_LifeCycleCORBA::preSet(Engines::MachineParameters& params) -{ - params.container_name = ""; - params.hostname = ""; - params.OS = ""; - params.mem_mb = 0; - params.cpu_clock = 0; - params.nb_proc_per_node = 0; - params.nb_node = 0; - params.isMPI = false; - params.workingdir = ""; - params.mode = ""; - params.policy = ""; - params.parallelLib = ""; - params.nb_component_nodes = 0; -} - void SALOME_LifeCycleCORBA::preSet(Engines::ResourceParameters& params) { @@ -456,6 +360,11 @@ SALOME_LifeCycleCORBA::preSet(Engines::ResourceParameters& params) params.can_run_containers = false; } +//============================================================================= +/*! \brief Initialisation of a given Engines::ContainerParameters with default values. + */ +//============================================================================= + void SALOME_LifeCycleCORBA::preSet( Engines::ContainerParameters& params) { params.container_name = ""; @@ -467,34 +376,6 @@ void SALOME_LifeCycleCORBA::preSet( Engines::ContainerParameters& params) SALOME_LifeCycleCORBA::preSet(params.resource_params); } -void -SALOME_LifeCycleCORBA::convert(const Engines::MachineParameters& params_in, - Engines::ContainerParameters& params_out) -{ - SALOME_LifeCycleCORBA::preSet(params_out); - - // Container part - params_out.container_name = params_in.container_name; - params_out.mode = params_in.mode; - params_out.workingdir = params_in.workingdir; - params_out.isMPI = params_in.isMPI; - params_out.parallelLib = params_in.parallelLib; - - // Resource part - params_out.resource_params.hostname = params_in.hostname; - params_out.resource_params.OS = params_in.OS; - params_out.resource_params.mem_mb = params_in.mem_mb; - params_out.resource_params.cpu_clock = params_in.cpu_clock; - params_out.resource_params.nb_node = params_in.nb_node; - params_out.resource_params.nb_proc_per_node = params_in.nb_proc_per_node; - params_out.resource_params.policy = params_in.policy; - params_out.resource_params.componentList = params_in.componentList; - - params_out.resource_params.resList.length(params_in.computerList.length()); - for (CORBA::ULong i = 0; i < params_in.computerList.length(); i++) - params_out.resource_params.resList[i] = params_in.computerList[i]; -} - //============================================================================= /*! * \return a number of processors not 0, only for MPI containers @@ -503,7 +384,7 @@ SALOME_LifeCycleCORBA::convert(const Engines::MachineParameters& params_in, int SALOME_LifeCycleCORBA::NbProc(const Engines::ContainerParameters& params) { - if( !isMpiContainer(params) ) + if( !params.isMPI ) return 0; else if( params.nb_proc <= 0 ) return 1; @@ -774,7 +655,9 @@ _FindComponent(const Engines::ContainerParameters& params, for(unsigned int i=0; i < listOfResources.length(); i++) { const char * currentResource = listOfResources[i]; - CORBA::Object_var obj = _NS->ResolveComponent(currentResource, + Engines::ResourceDefinition_var resource_definition = + _ResManager->GetResourceDefinition(currentResource); + CORBA::Object_var obj = _NS->ResolveComponent(resource_definition->hostname.in(), containerName, componentName, nbproc); @@ -787,7 +670,9 @@ _FindComponent(const Engines::ContainerParameters& params, { resourcesOK->length(lghtOfresourcesOK); CORBA::String_var bestResource = _ResManager->FindFirst(resourcesOK); - CORBA::Object_var obj = _NS->ResolveComponent(bestResource, + Engines::ResourceDefinition_var resource_definition = + _ResManager->GetResourceDefinition(bestResource); + CORBA::Object_var obj = _NS->ResolveComponent(resource_definition->hostname.in(), containerName, componentName, nbproc); diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index be24867f0..671af8fcd 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -65,21 +65,15 @@ public: virtual ~SALOME_LifeCycleCORBA(); Engines::EngineComponent_ptr - FindComponent(const Engines::MachineParameters& params, + FindComponent(const Engines::ContainerParameters& params, const char *componentName, int studyId=0); Engines::EngineComponent_ptr - LoadComponent(const Engines::MachineParameters& params, + LoadComponent(const Engines::ContainerParameters& params, const char *componentName, int studyId=0); - Engines::EngineComponent_ptr - FindOrLoad_Component(const Engines::MachineParameters& params, - const char *componentName, - int studyId =0); - - // SALOME 6 - Interface Engines::EngineComponent_ptr FindOrLoad_Component(const Engines::ContainerParameters& params, const char *componentName, @@ -87,7 +81,7 @@ public: Engines::EngineComponent_ptr FindOrLoad_Component(const char *containerName, - const char *componentName); // for compatibility + const char *componentName); // Parallel extension Engines::EngineComponent_ptr @@ -97,12 +91,8 @@ public: bool isKnownComponentClass(const char *componentName); - bool isMpiContainer(const Engines::ContainerParameters& params) - throw(IncompatibleComponent); - int NbProc(const Engines::ContainerParameters& params); - static void preSet(Engines::MachineParameters& outparams); static void preSet(Engines::ResourceParameters& outparams); static void preSet(Engines::ContainerParameters& outparams); @@ -115,10 +105,6 @@ public: void shutdownServers(); static void killOmniNames(); - // For SALOME 5.1.x - // Will be deleted on SALOME 6 - void convert(const Engines::MachineParameters& params_in, - Engines::ContainerParameters& params_out); protected: /*! Establish if a component called "componentName" in a container called diff --git a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx index 6d7101842..410c80706 100644 --- a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx +++ b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx @@ -420,7 +420,7 @@ LifeCycleCORBATest::testFindOrLoad_Component_ParamsEmpty() { SALOME_LifeCycleCORBA _LCC(&_NS); - Engines::MachineParameters params; + Engines::ContainerParameters params; _LCC.preSet(params); Engines::EngineComponent_var mycompo = _LCC.FindOrLoad_Component(params,"SalomeTestComponent"); @@ -443,10 +443,10 @@ LifeCycleCORBATest::testFindOrLoad_Component_ParamsLocalContainer() { SALOME_LifeCycleCORBA _LCC(&_NS); - Engines::MachineParameters params; + Engines::ContainerParameters params; _LCC.preSet(params); std::string hostname=Kernel_Utils::GetHostname(); - params.hostname=hostname.c_str(); + params.resource_params.hostname=hostname.c_str(); Engines::EngineComponent_var mycompo = _LCC.FindOrLoad_Component(params,"SalomeTestComponent"); CPPUNIT_ASSERT(!CORBA::is_nil(mycompo)); @@ -477,7 +477,7 @@ LifeCycleCORBATest::testFindOrLoad_Component_ParamsContainerName() { SALOME_LifeCycleCORBA _LCC(&_NS); - Engines::MachineParameters params; + Engines::ContainerParameters params; _LCC.preSet(params); std::string containerName = "myContainer"; params.container_name = containerName.c_str(); @@ -551,9 +551,9 @@ LifeCycleCORBATest::testFindOrLoad_Component_ParamsRemoteComputer() std::string remoteHost = GetRemoteHost(); - Engines::MachineParameters params; + Engines::ContainerParameters params; _LCC.preSet(params); - params.hostname = remoteHost.c_str(); + params.resource_params.hostname = remoteHost.c_str(); Engines::EngineComponent_var mycompo1 = _LCC.FindOrLoad_Component(params,"SalomeTestComponent"); @@ -589,9 +589,9 @@ LifeCycleCORBATest::testFindOrLoad_Component_ParamsRemoteComputer2() std::string remoteHost = GetRemoteHost(); - Engines::MachineParameters params; + Engines::ContainerParameters params; _LCC.preSet(params); - params.hostname = remoteHost.c_str(); + params.resource_params.hostname = remoteHost.c_str(); params.container_name = "anotherContainer"; Engines::EngineComponent_var mycompo1 = diff --git a/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py b/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py index 44d42461f..ab676f635 100644 --- a/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py +++ b/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py @@ -40,14 +40,6 @@ class LifeCycleCORBA (SALOME_LifeCycleCORBA): containerName, componentName) -class MachineParameters (Engines.MachineParameters): - def __init__(self, container_name='', hostname='', componentList=[], computerList=[], OS='', - mem_mb=0, cpu_clock=0, nb_proc_per_node=0, nb_node=0, isMPI=False, workingdir='', - mode='start', policy='altcycl', parallelLib='', nb_component_nodes=0): - Engines.MachineParameters.__init__(self,container_name, hostname, componentList, computerList, OS, - mem_mb, cpu_clock, nb_proc_per_node, nb_node, isMPI, workingdir, - mode, policy, parallelLib, nb_component_nodes) - class ContainerParameters (Engines.ContainerParameters): def __init__(self, container_name='', mode='start', workingdir='', nb_proc=0, isMPI=False, parallelLib='',resource_params=None): if resource_params is None:resource_params=ResourceParameters() @@ -56,10 +48,10 @@ class ContainerParameters (Engines.ContainerParameters): class ResourceParameters (Engines.ResourceParameters): def __init__(self, name="", hostname="", OS="", componentList=[], nb_proc=0, mem_mb=0, cpu_clock=0, nb_node=0, nb_proc_per_node=0, - policy="", resList=[]): - Engines.ResourceParameters.__init__(self, name, hostname, OS, componentList, - nb_proc, mem_mb, cpu_clock, nb_node, nb_proc_per_node, - policy, resList) + policy="", resList=[], can_launch_batch_jobs = False, can_run_containers = False): + Engines.ResourceParameters.__init__(self, name, hostname, can_launch_batch_jobs, can_run_containers, + OS, componentList, nb_proc, mem_mb, cpu_clock, nb_node, + nb_proc_per_node, policy, resList) class JobParameters (Engines.JobParameters): def __init__(self, job_name="", job_type="", job_file="", env_file="", in_files=[], out_files=[], @@ -72,7 +64,9 @@ class JobParameters (Engines.JobParameters): class ResourceDefinition(Engines.ResourceDefinition): def __init__(self, name="", hostname="", protocol="rsh", username="", applipath="", componentList=[], mode="interactive", OS="", mem_mb=1, cpu_clock=1, nb_node=1, nb_proc_per_node=1, - batch="", mpiImpl="", iprotocol="rsh"): - Engines.ResourceDefinition.__init__(self, name, hostname, protocol, username, applipath, componentList, - mode, OS, mem_mb, cpu_clock, nb_node, nb_proc_per_node, batch, - mpiImpl, iprotocol) + batch="", mpiImpl="", iprotocol="rsh", type = "single_machine", + can_launch_batch_jobs = False, can_run_containers = False, working_directory = ""): + Engines.ResourceDefinition.__init__(self, name, hostname, type, protocol, username, applipath, + componentList, OS, mem_mb, cpu_clock, nb_node, nb_proc_per_node, + batch, mpiImpl, iprotocol, can_launch_batch_jobs, + can_run_containers, working_directory) diff --git a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py index 31d1d310f..7fb60dfeb 100644 --- a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py +++ b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py @@ -37,10 +37,9 @@ try : obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent") comp=obj._narrow(Engines.TestComponent) comp.Coucou(1) - param={} - #param['hostname']='cli76cc' - param['hostname']=host - param['container_name']='FactoryServer' + param = LifeCycleCORBA.ContainerParameters() + param.resource_params.hostname = host + param.container_name = 'FactoryServer' comp=lcc.FindOrLoad_Component(param,'SalomeTestComponent') engine=lcc.FindComponent(param,'SalomeTestComponent') engine.Coucou(1) @@ -58,31 +57,32 @@ context_name.append(CosNaming.NameComponent( 'ContainerManager' , 'object' ) ) ContainerManager = rootContext.resolve( context_name ) try : - myContainerparamsCPP = Engines.MachineParameters( 'myContainer' , host , 'osf' , 0 , 0 , 0 , 0 , 0 ) + myContainerparamsCPP = LifeCycleCORBA.ContainerParameters() + param.resource_params.hostname = host + param.container_name = 'myContainer' computerlistCPP = [host] containerCPP = ContainerManager.FindOrStartContainer( myContainerparamsCPP , computerlistCPP ) containerCPP.ping() ComponentparamsCPP={} ComponentparamsCPP['hostname']=host ComponentparamsCPP['container_name']='myContainer' - compCPP=lcc.FindOrLoad_Component(ComponentparamsCPP,'SalomeTestComponent') + compCPP=lcc.FindOrLoad_Component(myContainerparamsCPP,'SalomeTestComponent') compCPP.Coucou(1) - engineCPP=lcc.FindComponent(ComponentparamsCPP,'SalomeTestComponent') + engineCPP=lcc.FindComponent(myContainerparamsCPP,'SalomeTestComponent') engineCPP.Coucou(1) except : print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) C++ failed' try : - myContainerparamsPy = Engines.MachineParameters( 'myContainerPy' , host , 'osf' , 0 , 0 , 0 , 0 , 0 ) + myContainerparamsPy = LifeCycleCORBA.ContainerParameters() + param.resource_params.hostname = host + param.container_name = 'myContainerPy' computerlistPy = [host] containerPy = ContainerManager.FindOrStartContainer( myContainerparamsPy , computerlistPy ) containerPy.ping() - ComponentparamsPy={} - ComponentparamsPy['hostname']=host - ComponentparamsPy['container_name']='myContainerPy' - compPy=lcc.FindOrLoad_Component(ComponentparamsPy,'SALOME_TestComponentPy') + compPy=lcc.FindOrLoad_Component(myContainerparamsPy,'SALOME_TestComponentPy') compPy.Coucou(1) - enginePy=lcc.FindComponent(ComponentparamsPy,'SALOME_TestComponentPy') + enginePy=lcc.FindComponent(myContainerparamsPy,'SALOME_TestComponentPy') enginePy.Coucou(1) except : print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) Python failed' diff --git a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i index 3990d9d86..59ccceaa6 100644 --- a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i +++ b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i @@ -119,18 +119,21 @@ omniORBpyAPI* api; } } -%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const Engines::MachineParameters & +// We use a dictionary to represent ContainerParameters structure instead of the CORBA +// structure itself because it would require a transformation from the Python +// ContainerParameters structure, generated by omniOrbPy, to a C++ ContainerParameters +// structure, generated by omniOrb, and this would be quite complex. +%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const Engines::ContainerParameters & { $1 = PyDict_Check($input)? 1 : 0; } -%typemap(in) const Engines::MachineParameters & +%typemap(in) const Engines::ContainerParameters & { - //printf("typemap in on Engines::MachineParameters\n"); - MESSAGE("typemap in on Engines::MachineParameters"); + MESSAGE("typemap in on Engines::ContainerParameters"); if (PyDict_Check($input) == 1) { - Engines::MachineParameters *param = new Engines::MachineParameters ; + Engines::ContainerParameters *param = new Engines::ContainerParameters ; SALOME_LifeCycleCORBA::preSet(*param); PyObject *key, *value; @@ -142,29 +145,33 @@ omniORBpyAPI* api; { param->container_name = CORBA::string_dup(PyString_AsString(value)); } + else if (strcmp(keystr,"resource_name")==0) + { + param->resource_params.name = CORBA::string_dup(PyString_AsString(value)); + } else if (strcmp(keystr,"hostname")==0) { - param->hostname = CORBA::string_dup(PyString_AsString(value)); + param->resource_params.hostname = CORBA::string_dup(PyString_AsString(value)); } else if (strcmp(keystr,"OS")==0) { - param->OS = CORBA::string_dup(PyString_AsString(value)); + param->resource_params.OS = CORBA::string_dup(PyString_AsString(value)); } else if (strcmp(keystr,"mem_mb")==0) { - param->mem_mb = PyLong_AsLong(value); + param->resource_params.mem_mb = PyLong_AsLong(value); } else if (strcmp(keystr,"cpu_clock")==0) { - param->cpu_clock = PyLong_AsLong(value); + param->resource_params.cpu_clock = PyLong_AsLong(value); } else if (strcmp(keystr,"nb_proc_per_node")==0) { - param->nb_proc_per_node = PyLong_AsLong(value); + param->resource_params.nb_proc_per_node = PyLong_AsLong(value); } else if (strcmp(keystr,"nb_node")==0) { - param->nb_node = PyLong_AsLong(value); + param->resource_params.nb_node = PyLong_AsLong(value); } else if (strcmp(keystr,"isMPI")==0) { @@ -175,28 +182,24 @@ omniORBpyAPI* api; else if (strcmp(keystr,"mode")==0) param->mode = CORBA::string_dup(PyString_AsString(value)); else if (strcmp(keystr,"policy")==0) - param->policy = CORBA::string_dup(PyString_AsString(value)); + param->resource_params.policy = CORBA::string_dup(PyString_AsString(value)); else if (strcmp(keystr,"parallelLib")==0) { param->parallelLib = CORBA::string_dup(PyString_AsString(value)); } - else if (strcmp(keystr,"nb_component_nodes")==0) - { - param->nb_component_nodes = PyLong_AsLong(value); - } } $1 = param; } else { - MESSAGE("Not a dictionnary"); - PyErr_SetString(PyExc_TypeError,"Must Be a Python Dictionnary"); + MESSAGE("Not a ContainerParameters struct"); + PyErr_SetString(PyExc_TypeError,"Must Be a Python ContainerParameters object"); return NULL; } } -%typemap(freearg) const Engines::MachineParameters & +%typemap(freearg) const Engines::ContainerParameters & { MESSAGE("delete $1"); delete $1; diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index b58acc661..31acb78c4 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -587,48 +587,18 @@ std::string SALOME_NamingService::ContainerName(const char *containerName) } // ============================================================================ -/*! \brief build a container name, given a MachineParameters struct. +/*! \brief build a container name, given a ContainerParameters struct. * - * Build a container name with a MachineParameters struct. In case of multi - * processor machine, container name is suffixed with _nbproc. nproc equals - * (number of nodes)*(number of processor per nodes). - * \param params struct from which we get container name (may be - * empty), number of nodes and number of processor - * per node. + * Build a container name with a ContainerParameters struct. In case of multi + * processor machine, container name is suffixed with number of processors. + * \param params struct from which we get container name (may be empty) and + * number of processors. * \return a container name without the path. - * \sa BuildContainerNameForNS(const Engines::MachineParameters& params, + * \sa BuildContainerNameForNS(const Engines::ContainerParameters& params, * const char *hostname) */ // ============================================================================ -std::string -SALOME_NamingService::ContainerName(const Engines::MachineParameters& params) -{ - int nbproc; - - if ( !params.isMPI ) - nbproc = 0; - else if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) ) - nbproc = 1; - else if ( params.nb_node == 0 ) - nbproc = params.nb_proc_per_node; - else if ( params.nb_proc_per_node == 0 ) - nbproc = params.nb_node; - else - nbproc = params.nb_node * params.nb_proc_per_node; - - std::string ret = ContainerName(params.container_name); - - if ( nbproc >= 1 ) - { - char *suffix = new char[8]; - sprintf(suffix, "_%d", nbproc); - ret += suffix; - } - - return ret; -} - std::string SALOME_NamingService::ContainerName(const Engines::ContainerParameters& params) { @@ -690,19 +660,6 @@ std::string SALOME_NamingService::BuildContainerNameForNS(const char *containerN */ // ============================================================================ -std::string -SALOME_NamingService:: -BuildContainerNameForNS(const Engines::MachineParameters& params, - const char *hostname) -{ - std::string ret = "/Containers/"; - ret += hostname; - ret += "/"; - ret += ContainerName(params); - - return ret; -} - std::string SALOME_NamingService:: BuildContainerNameForNS(const Engines::ContainerParameters& params, diff --git a/src/NamingService/SALOME_NamingService.hxx b/src/NamingService/SALOME_NamingService.hxx index fa30e8db6..def34d138 100644 --- a/src/NamingService/SALOME_NamingService.hxx +++ b/src/NamingService/SALOME_NamingService.hxx @@ -74,11 +74,6 @@ public: BuildContainerNameForNS(const Engines::ContainerParameters& params, const char *hostname); - // Will Be deleted on SALOME 6 - std::string ContainerName(const Engines::MachineParameters& params); - std::string - BuildContainerNameForNS(const Engines::MachineParameters& params, - const char *hostname); int Find(const char* name) throw(ServiceUnreachable); bool Create_Directory(const char* Path) diff --git a/src/NamingService/Test/CMakeLists.txt b/src/NamingService/Test/CMakeLists.txt index 6f675c91d..e7544a2e6 100755 --- a/src/NamingService/Test/CMakeLists.txt +++ b/src/NamingService/Test/CMakeLists.txt @@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../../LifeCycleCORBA ${CMAKE_BINARY_DIR}/idl ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace/Test ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector/Test @@ -37,6 +38,7 @@ INCLUDE_DIRECTORIES( SET(COMMON_LIBS ${CPPUNIT_LIBS} SalomeNS + SalomeLifeCycleCORBA ${OMNIORB_LIBS} ) diff --git a/src/NamingService/Test/Makefile.am b/src/NamingService/Test/Makefile.am index f8073e03c..113e088f4 100644 --- a/src/NamingService/Test/Makefile.am +++ b/src/NamingService/Test/Makefile.am @@ -55,13 +55,16 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Basics \ -I$(srcdir)/$(RPATH)/SALOMELocalTrace \ -I$(srcdir)/$(RPATH)/Utils \ + -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ @CPPUNIT_LIBS@ \ - ../libSalomeNS.la @CORBA_LIBS@ + ../libSalomeNS.la \ + ../../LifeCycleCORBA/libSalomeLifeCycleCORBA.la \ + @CORBA_LIBS@ # # =============================================================== diff --git a/src/NamingService/Test/NamingServiceTest.cxx b/src/NamingService/Test/NamingServiceTest.cxx index b36194d05..e48ebc1ed 100644 --- a/src/NamingService/Test/NamingServiceTest.cxx +++ b/src/NamingService/Test/NamingServiceTest.cxx @@ -24,6 +24,7 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" #include "Basics_Utils.hxx" +#include "SALOME_LifeCycleCORBA.hxx" #include #include @@ -824,15 +825,8 @@ NamingServiceTest::testContainerName() void NamingServiceTest::testContainerNameParams() { - Engines::MachineParameters params; - params.container_name = ""; - params.hostname = ""; - params.OS = ""; - params.mem_mb = 0; - params.cpu_clock = 0; - params.nb_proc_per_node = 0; - params.nb_node = 0; - params.isMPI = false; + Engines::ContainerParameters params; + SALOME_LifeCycleCORBA::preSet(params); std::string ref0 = "FactoryServer"; std::string ret = _NS.ContainerName(params); @@ -871,15 +865,8 @@ NamingServiceTest::testBuildContainerNameForNS() void NamingServiceTest::testBuildContainerNameForNSParams() { - Engines::MachineParameters params; - params.container_name = ""; - params.hostname = ""; - params.OS = ""; - params.mem_mb = 0; - params.cpu_clock = 0; - params.nb_proc_per_node = 0; - params.nb_node = 0; - params.isMPI = false; + Engines::ContainerParameters params; + SALOME_LifeCycleCORBA::preSet(params); params.container_name = "theContainerName"; std::string ref0 = "/Containers/theHostName/theContainerName"; -- 2.39.2