Salome HOME
56cae6c300b083b0a473022c110a79c71ba12ffc
[modules/kernel.git] / src / Batch / Batch_BatchManager.cxx
1 /*
2  * BatchManager.cxx : 
3  *
4  * Auteur : Ivan DUTKA-MALEN - EDF R&D
5  * Date   : Septembre 2003
6  * Projet : SALOME 2
7  *
8  */
9
10 #include <iostream>
11 #include <sstream>
12 #include <string>
13 #include <netdb.h>
14 //#include "MEDMEM_STRING.hxx"
15 #include "Batch_Job.hxx"
16 #include "Batch_JobId.hxx"
17 #include "Batch_JobInfo.hxx"
18 #include "Batch_InvalidArgumentException.hxx"
19 #include "Batch_FactBatchManager.hxx"
20 #include "Batch_BatchManager.hxx"
21 using namespace std;
22
23 namespace Batch {
24
25   // Constructeur
26 //   BatchManager::BatchManager(string host) throw(InvalidArgumentException) : _hostname(host), jobid_map()
27 //   {
28 //     // On verifie que le hostname est correct
29 //     if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
30 //       string msg = "hostname \"";
31 //       msg += _hostname;
32 //       msg += "\" unknown from the network";
33 //       throw InvalidArgumentException(msg.c_str());
34 //     }
35 //   }
36   BatchManager::BatchManager(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException) : _hostname(host), jobid_map(), _parent(parent)
37   {
38     // On verifie que le hostname est correct
39     if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
40       string msg = "hostname \"";
41       msg += _hostname;
42       msg += "\" unknown from the network";
43       throw InvalidArgumentException(msg.c_str());
44     }
45   }
46
47   // Destructeur
48   BatchManager::~BatchManager()
49   {
50     // Nothing to do
51   }
52
53   string BatchManager::__repr__() const
54   {
55     ostringstream oss;
56     oss << "<BatchManager of type '" << (_parent ? _parent->getType() : "unknown (no factory)") << "' connected to server '" << _hostname << "'>";
57     return oss.str();
58   }
59
60   // Recupere le l'identifiant d'un job deja soumis au BatchManager
61 //   const JobId BatchManager::getJobIdByReference(const string & ref)
62 //   {
63 //     return JobId(this, ref);
64 //   }
65   const JobId BatchManager::getJobIdByReference(const char * ref)
66   {
67     return JobId(this, ref);
68   }
69
70 //   // Methode pour le controle des jobs : soumet un job au gestionnaire
71 //   const JobId BatchManager::submitJob(const Job & job)
72 //   {
73 //     static int idx = 0;
74 //     //MEDMEM::STRING sst;
75 //     ostringstream sst;
76 //     sst << "Jobid_" << idx++;
77 //     JobId id(this, sst.str());
78 //     return id;
79 //   }
80
81 //   // Methode pour le controle des jobs : retire un job du gestionnaire
82 //   void BatchManager::deleteJob(const JobId & jobid)
83 //   {
84 //     // Nothing to do
85 //   }
86    
87 //   // Methode pour le controle des jobs : suspend un job en file d'attente
88 //   void BatchManager::holdJob(const JobId & jobid)
89 //   {
90 //     // Nothing to do
91 //   }
92
93 //   // Methode pour le controle des jobs : relache un job suspendu
94 //   void BatchManager::releaseJob(const JobId & jobid)
95 //   {
96 //     // Nothing to do
97 //   }
98
99 //   // Methode pour le controle des jobs : modifie un job en file d'attente
100 //   void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
101 //   {
102 //     // Nothing to do
103 //   }
104
105 //   // Methode pour le controle des jobs : modifie un job en file d'attente
106 //   void BatchManager::alterJob(const JobId & jobid, const Parametre & param)
107 //   {
108 //     // Nothing to do
109 //   }
110
111 //   // Methode pour le controle des jobs : modifie un job en file d'attente
112 //   void BatchManager::alterJob(const JobId & jobid, const Environnement & env)
113 //   {
114 //     // Nothing to do
115 //   }
116
117 //   // Methode pour le controle des jobs : renvoie l'etat du job
118 //   JobInfo BatchManager::queryJob(const JobId & jobid)
119 //   {
120 //     return JobInfo();
121 //   }
122
123 }