Salome HOME
0302900af7392cd382d7c7972579418347f94aef
[modules/kernel.git] / src / LifeCycleCORBA_SWIG / LifeCycleCORBA.py
1 #  -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
3 #
4 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23
24 #  SALOME LifeCycleCORBA : implementation of containers and engines life cycle both in Python and C++
25 #  File   : LifeCycleCORBA.py
26 #  Author : Paul RASCLE, EDF
27 #  Module : SALOME
28 #  $Header$
29 #
30 import Engines
31 from libSALOME_LifeCycleCORBA import *
32
33 class LifeCycleCORBA(SALOME_LifeCycleCORBA):
34
35     def __init__(self, orb = None):
36         SALOME_LifeCycleCORBA.__init__(self)
37
38     def FindOrLoadComponent(self, containerName, componentName):
39         return SALOME_LifeCycleCORBA.FindOrLoad_Component(self,containerName,componentName)
40
41 class LifeCycleCORBASSL(SALOME_LifeCycleCORBASSL):
42     def __init__(self):
43         SALOME_LifeCycleCORBASSL.__init__(self)
44     def FindOrLoadComponent(self, containerName, componentName):
45         return SALOME_LifeCycleCORBA.FindOrLoad_Component(self,containerName,componentName)
46
47 class ContainerParameters (Engines.ContainerParameters):
48   def __init__(self, container_name='', mode='start', workingdir='', nb_proc=0, isMPI=False, parallelLib='',resource_params=None):
49     if resource_params is None:resource_params=ResourceParameters()
50     Engines.ContainerParameters.__init__(self,container_name, mode, workingdir, nb_proc, isMPI, parallelLib,resource_params)
51
52 class ResourceParameters (Engines.ResourceParameters):
53   def __init__(self, name="", hostname="", OS="", componentList=None,
54                      nb_proc=0, mem_mb=0, cpu_clock=0, nb_node=0, nb_proc_per_node=0,
55                      policy="", resList=None, can_launch_batch_jobs = False, can_run_containers = False):
56     if componentList is None:
57       componentList = []
58     if resList is None:
59       resList = []
60     Engines.ResourceParameters.__init__(self, name, hostname, can_launch_batch_jobs, can_run_containers,
61                                         OS, componentList, nb_proc, mem_mb, cpu_clock, nb_node,
62                                         nb_proc_per_node, policy, resList)
63
64 class JobParameters (Engines.JobParameters):
65   def __init__(self, job_name="", job_type="", job_file="", pre_command="", env_file="", in_files=None, out_files=None,
66                      work_directory="", local_directory="", result_directory="", maximum_duration="",
67                      resource_required=None, queue="", partition="", exclusive = False, mem_per_cpu = 0,
68                      wckey = "", extra_params = "",
69                      specific_parameters=None, launcher_file = "", launcher_args = ""):
70     if in_files is None:
71       in_files = []
72     if out_files is None:
73       out_files = []
74     if specific_parameters is None:
75       specific_parameters = []
76     Engines.JobParameters.__init__(self, job_name, job_type, job_file, pre_command, env_file, in_files, out_files,
77                                          work_directory, local_directory, result_directory, maximum_duration,
78                                          resource_required, queue, partition, exclusive, mem_per_cpu,
79                                          wckey, extra_params,
80                                          specific_parameters, launcher_file, launcher_args)
81
82 class ResourceDefinition(Engines.ResourceDefinition):
83   def __init__(self, name="", hostname="", protocol="rsh", username="", applipath="", componentList=None,
84                mode="interactive", OS="", mem_mb=1, cpu_clock=1, nb_node=1, nb_proc_per_node=1,
85                batch="", mpiImpl="", iprotocol="rsh", type = "single_machine",
86                can_launch_batch_jobs = False, can_run_containers = False, working_directory = ""):
87     if componentList is None:
88       componentList = []
89     Engines.ResourceDefinition.__init__(self, name, hostname, type, protocol, username, applipath,
90                                         componentList, OS, mem_mb, cpu_clock, nb_node, nb_proc_per_node,
91                                         batch, mpiImpl, iprotocol, can_launch_batch_jobs,
92                                         can_run_containers, working_directory)