ATLAS Offline Software
ProcessGroup.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ATHENAINTERPROCESS_PROCESSGROUP_H
6 #define ATHENAINTERPROCESS_PROCESSGROUP_H
7 
11 #include <vector>
12 
13 namespace AthenaInterprocess {
14 
15 class IMessageDecoder;
16 
17 struct ProcessStatus {
19  int exitcode;
20 };
21 
22 struct ProcessResult {
25 };
26 
27 class ProcessGroup {
28  public:
29  explicit ProcessGroup(int nprocs = -1);
30 
31  virtual ~ProcessGroup();
32 
33  pid_t launchProcess ATLAS_NOT_THREAD_SAFE (); // Add one new process to the group
34 
35  int map_async ATLAS_NOT_THREAD_SAFE (const IMessageDecoder* func, const ScheduledWork* args, pid_t pid=0); // If pid=0 map on the entire group
36  int wait ATLAS_NOT_THREAD_SAFE (int options = 0);
37  pid_t wait_once(bool& flag); // flag=true if process succeeded, flag=false otherwise
38  ProcessResult* pullOneResult(); // The caller takes ownership on the result
39 
40  pid_t getGroupID() const;
41  const std::vector<Process>& getChildren() const;
42  const std::vector<ProcessStatus>& getStatuses() const;
43 
44  private:
45  bool create ATLAS_NOT_THREAD_SAFE ();
46 
47  std::vector<Process> m_processes;
48  std::vector<ProcessStatus> m_statuses;
50  int m_nprocs;
52  int m_processesCreated; // Keep track of total number of created processes
53  // This can be more than m_nprocs if some processes have been launched later on
54  // (restarting failed processes)
55 };
56 
57 } // namespace AthenaInterprocess
58 
59 #endif // !ATHENAINTERPROCESS_PROCESSGROUP_H
pid_t
int32_t pid_t
Definition: FPGATrackSimTypes.h:19
AthenaInterprocess
Definition: FdsRegistry.h:11
AthenaInterprocess::ProcessGroup::ATLAS_NOT_THREAD_SAFE
pid_t launchProcess ATLAS_NOT_THREAD_SAFE()
AthenaInterprocess::ProcessGroup::getStatuses
const std::vector< ProcessStatus > & getStatuses() const
Definition: ProcessGroup.cxx:204
AthenaInterprocess::ProcessGroup::pullOneResult
ProcessResult * pullOneResult()
Definition: ProcessGroup.cxx:177
IdentifiedSharedQueue.h
AthenaInterprocess::ScheduledWork
Definition: IMessageDecoder.h:12
AthenaInterprocess::ProcessGroup::getChildren
const std::vector< Process > & getChildren() const
Definition: ProcessGroup.cxx:197
AthenaInterprocess::ProcessGroup::ATLAS_NOT_THREAD_SAFE
bool create ATLAS_NOT_THREAD_SAFE()
AthenaInterprocess::ProcessResult::pid
pid_t pid
Definition: ProcessGroup.h:23
Process.h
AthenaInterprocess::ProcessStatus::exitcode
int exitcode
Definition: ProcessGroup.h:19
AthenaInterprocess::ProcessGroup::ProcessGroup
ProcessGroup(int nprocs=-1)
Definition: ProcessGroup.cxx:34
LHEonly.nprocs
nprocs
Definition: LHEonly.py:17
AthenaInterprocess::ProcessGroup::m_statuses
std::vector< ProcessStatus > m_statuses
Definition: ProcessGroup.h:48
AthenaInterprocess::ProcessResult::output
ScheduledWork output
Definition: ProcessGroup.h:24
AthenaInterprocess::ProcessGroup::m_processes
std::vector< Process > m_processes
Definition: ProcessGroup.h:47
AthenaInterprocess::ProcessGroup::getGroupID
pid_t getGroupID() const
Definition: ProcessGroup.cxx:192
AthenaInterprocess::ProcessGroup::ATLAS_NOT_THREAD_SAFE
int map_async ATLAS_NOT_THREAD_SAFE(const IMessageDecoder *func, const ScheduledWork *args, pid_t pid=0)
AthenaInterprocess::ProcessGroup
Definition: ProcessGroup.h:27
master.flag
bool flag
Definition: master.py:29
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
python.AtlRunQueryLib.options
options
Definition: AtlRunQueryLib.py:379
AthenaInterprocess::ProcessGroup::m_inbox
IdentifiedSharedQueue m_inbox
Definition: ProcessGroup.h:49
AthenaInterprocess::ProcessGroup::m_pgid
pid_t m_pgid
Definition: ProcessGroup.h:51
AthenaInterprocess::IMessageDecoder
Definition: IMessageDecoder.h:18
AthenaInterprocess::ProcessGroup::~ProcessGroup
virtual ~ProcessGroup()
Definition: ProcessGroup.cxx:45
AthenaInterprocess::ProcessGroup::ATLAS_NOT_THREAD_SAFE
int wait ATLAS_NOT_THREAD_SAFE(int options=0)
AthenaInterprocess::ProcessGroup::m_processesCreated
int m_processesCreated
Definition: ProcessGroup.h:52
AthenaInterprocess::ProcessStatus::pid
pid_t pid
Definition: ProcessGroup.h:18
AthenaInterprocess::IdentifiedSharedQueue
Definition: IdentifiedSharedQueue.h:14
AthenaInterprocess::ProcessGroup::m_nprocs
int m_nprocs
Definition: ProcessGroup.h:50
AthenaInterprocess::ProcessResult
Definition: ProcessGroup.h:22
checker_macros.h
Define macros for attributes used to control the static checker.
AthenaInterprocess::ProcessGroup::wait_once
pid_t wait_once(bool &flag)
Definition: ProcessGroup.cxx:149
AthenaInterprocess::ProcessStatus
Definition: ProcessGroup.h:17
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80