ATLAS Offline Software
Loading...
Searching...
No Matches
WorkerConfigModule.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8//
9// includes
10//
11
13
14#include <EventLoop/Job.h>
17#include <EventLoop/Worker.h>
20#include <TPython.h>
21
22//
23// method implementations
24//
25
26namespace EL
27{
28 namespace Detail
29 {
30 StatusCode WorkerConfigModule ::
31 onInitialize (ModuleData& data)
32 {
33 std::string configFile = data.m_worker->metaData()->castString (Job::optWorkerConfigFile, "");
34 if (!configFile.empty())
35 {
36 const std::string resolved = PathResolverFindDataFile (configFile);
37 if (resolved.empty())
38 {
39 ANA_MSG_ERROR ("failed to find worker config file " << configFile);
40 return StatusCode::FAILURE;
41 }
42 TPython::LoadMacro (resolved.c_str());
43 WorkerConfig config (&data);
44 if (!TPython::Bind (&config, "workerConfig"))
45 {
46 ANA_MSG_ERROR ("failed to bind the worker config object");
47 return StatusCode::FAILURE;
48 }
49 if (!TPython::Exec ("fillWorkerConfig (workerConfig)"))
50 {
51 ANA_MSG_ERROR ("failed to execute the worker config script " << resolved);
52 TPython::Bind (nullptr, "workerConfig");
53 return StatusCode::FAILURE;
54 }
55 TPython::Bind (nullptr, "workerConfig");
56 }
57
58 return StatusCode::SUCCESS;
59 }
60 }
61}
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
std::string PathResolverFindDataFile(const std::string &logical_file_name)
static const std::string optWorkerConfigFile
a python configuration file that will be executed on the worker
Definition Job.h:242
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
the data the EventLoop core classes are sharing with the Module implementation
Definition ModuleData.h:64