]> SALOME platform Git repositories - modules/kernel.git/blob - src/Batch/Batch_BatchManager.cxx
Salome HOME
BUG 0020024: a --gdb-session option to runSalome ...
[modules/kernel.git] / src / Batch / Batch_BatchManager.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 /*
21  * BatchManager.cxx : 
22  *
23  * Auteur : Ivan DUTKA-MALEN - EDF R&D
24  * Date   : Septembre 2003
25  * Projet : SALOME 2
26  *
27  */
28
29 #include <iostream>
30 #include <sstream>
31 #include <string>
32 #ifdef WIN32
33 # include<winsock2.h>
34 #else
35 # include <netdb.h>
36 #endif
37
38 //#include "MEDMEM_STRING.hxx"
39 #include "Batch_Job.hxx"
40 #include "Batch_JobId.hxx"
41 #include "Batch_JobInfo.hxx"
42 #include "Batch_InvalidArgumentException.hxx"
43 #include "Batch_FactBatchManager.hxx"
44 #include "Batch_BatchManager.hxx"
45 using namespace std;
46
47 namespace Batch {
48
49   // Constructeur
50 //   BatchManager::BatchManager(string host) throw(InvalidArgumentException) : _hostname(host), jobid_map()
51 //   {
52 //     // On verifie que le hostname est correct
53 //     if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
54 //       string msg = "hostname \"";
55 //       msg += _hostname;
56 //       msg += "\" unknown from the network";
57 //       throw InvalidArgumentException(msg.c_str());
58 //     }
59 //   }
60   BatchManager::BatchManager(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException) : _hostname(host), jobid_map(), _parent(parent)
61   {
62     // On verifie que le hostname est correct
63     if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
64       string msg = "hostname \"";
65       msg += _hostname;
66       msg += "\" unknown from the network";
67       throw InvalidArgumentException(msg.c_str());
68     }
69   }
70
71   // Destructeur
72   BatchManager::~BatchManager()
73   {
74     // Nothing to do
75   }
76
77   string BatchManager::__repr__() const
78   {
79     ostringstream oss;
80     oss << "<BatchManager of type '" << (_parent ? _parent->getType() : "unknown (no factory)") << "' connected to server '" << _hostname << "'>";
81     return oss.str();
82   }
83
84   // Recupere le l'identifiant d'un job deja soumis au BatchManager
85 //   const JobId BatchManager::getJobIdByReference(const string & ref)
86 //   {
87 //     return JobId(this, ref);
88 //   }
89   const JobId BatchManager::getJobIdByReference(const char * ref)
90   {
91     return JobId(this, ref);
92   }
93
94 //   // Methode pour le controle des jobs : soumet un job au gestionnaire
95 //   const JobId BatchManager::submitJob(const Job & job)
96 //   {
97 //     static int idx = 0;
98 //     //MEDMEM::STRING sst;
99 //     ostringstream sst;
100 //     sst << "Jobid_" << idx++;
101 //     JobId id(this, sst.str());
102 //     return id;
103 //   }
104
105 //   // Methode pour le controle des jobs : retire un job du gestionnaire
106 //   void BatchManager::deleteJob(const JobId & jobid)
107 //   {
108 //     // Nothing to do
109 //   }
110    
111 //   // Methode pour le controle des jobs : suspend un job en file d'attente
112 //   void BatchManager::holdJob(const JobId & jobid)
113 //   {
114 //     // Nothing to do
115 //   }
116
117 //   // Methode pour le controle des jobs : relache un job suspendu
118 //   void BatchManager::releaseJob(const JobId & jobid)
119 //   {
120 //     // Nothing to do
121 //   }
122
123 //   // Methode pour le controle des jobs : modifie un job en file d'attente
124 //   void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
125 //   {
126 //     // Nothing to do
127 //   }
128
129 //   // Methode pour le controle des jobs : modifie un job en file d'attente
130 //   void BatchManager::alterJob(const JobId & jobid, const Parametre & param)
131 //   {
132 //     // Nothing to do
133 //   }
134
135 //   // Methode pour le controle des jobs : modifie un job en file d'attente
136 //   void BatchManager::alterJob(const JobId & jobid, const Environnement & env)
137 //   {
138 //     // Nothing to do
139 //   }
140
141 //   // Methode pour le controle des jobs : renvoie l'etat du job
142 //   JobInfo BatchManager::queryJob(const JobId & jobid)
143 //   {
144 //     return JobInfo();
145 //   }
146
147 }