1 // Copyright (C) 2020-2021 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "YACSlibWorkloadmanagerExport.hxx"
26 namespace WorkloadManager
28 struct YACSLIBWLM_EXPORT ContainerType
30 // parameters needed by WorkloadManager
31 float neededCores = 0.0;
32 bool ignoreResources = false; // if true, the task can be run as soon as
33 // added to the manager without any resource
35 // parameters for client use, used by WorkloadManager to distinguish objects
38 bool operator==(const ContainerType& other)const
39 { return id == other.id && name == other.name;}
40 bool operator<(const ContainerType& other)const
42 return (id < other.id) ||
43 (id == other.id && name < other.name);
47 struct YACSLIBWLM_EXPORT Resource
49 unsigned int nbCores = 0; // needed by WorkloadManager
50 // parameters for client use, used by WorkloadManager to distinguish objects
53 bool operator==(const Resource& other)const
54 { return id == other.id && name == other.name;}
55 bool operator<(const Resource& other)const
57 return (id < other.id) ||
58 (id == other.id && name < other.name);
62 struct YACSLIBWLM_EXPORT RunInfo
66 unsigned int index=0; // worker index on the resource for this type
68 std::string error_message = "";
74 class YACSLIBWLM_EXPORT Task
78 virtual const ContainerType& type()const =0;
79 virtual void run(const RunInfo& c)=0;
81 // Is it possible to run the task on this resource?
82 virtual bool isAccepted(const Resource& r)
84 // by default, a task can be run on any resource.