Salome HOME
Copyright update 2021
[tools/libbatch.git] / src / OAR / BatchManager_OAR.hxx
1 // Copyright (C) 2012-2021  INRIA
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef _BATCHMANAGER_OAR_H_
21 #define _BATCHMANAGER_OAR_H_
22
23 #include "Defines.hxx"
24 #include "JobId.hxx"
25 #include "JobInfo.hxx"
26 #include "FactBatchManager.hxx"
27 #include "BatchManager.hxx"
28
29 namespace Batch
30 {
31   class BATCH_EXPORT BatchManager_OAR : public BatchManager
32   {
33     public:
34       // Constructeur
35       BatchManager_OAR(const FactBatchManager * parent, const char * host="localhost",
36                       const char * username="",
37                       CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi");
38
39       // Destructeur
40       virtual ~BatchManager_OAR();
41
42       // Soumet un job
43       virtual const JobId runJob(const Job & job);
44
45       // Supprime un job
46       virtual void deleteJob(const JobId & jobid);
47
48       // Donne l'etat du job
49       virtual JobInfo queryJob(const JobId & jobid);
50
51       // Modifie un job en file d'attente
52       virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); }
53
54       // Modifie un job en file d'attente
55       virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); }
56
57     protected:
58       std::string buildBatchScript(const Job & job);
59       std::string convertSecTo_H_M_S(long seconds) const;
60
61 #ifdef SWIG
62     public:
63       // Recupere l'identifiant d'un job deja soumis au BatchManager
64       virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
65 #endif
66   };
67 }
68
69 #endif