File indexing completed on 2024-04-06 12:13:08
0001 #include "FWCore/SharedMemory/interface/ControllerChannel.h"
0002 #include "FWCore/SharedMemory/interface/WorkerChannel.h"
0003 #include "FWCore/Utilities/interface/Exception.h"
0004
0005 #include <memory>
0006 #include <string>
0007 #include <stdio.h>
0008 #include <cassert>
0009
0010 #include "controller.h"
0011 #include "worker.h"
0012 namespace {
0013 const char* jobType(bool isWorker) {
0014 if (isWorker) {
0015 return "Worker";
0016 }
0017 return "Controller";
0018 }
0019 }
0020
0021 int main(int argc, char** argv) {
0022 bool isWorker = true;
0023 int retValue = 0;
0024 try {
0025 if (argc > 1) {
0026 retValue = worker(argc, argv, WorkerType::kStandard);
0027 } else {
0028 isWorker = false;
0029 retValue = controller(argc, argv, 60);
0030 }
0031 } catch (std::exception const& iException) {
0032 std::cerr << "Caught exception\n" << iException.what() << "\n";
0033 if (isWorker) {
0034 std::cerr << "in worker\n";
0035 } else {
0036 std::cerr << "in controller\n";
0037 }
0038 return 1;
0039 }
0040 if (0 == retValue) {
0041 std::cout << jobType(isWorker) << " success" << std::endl;
0042 } else {
0043 std::cout << jobType(isWorker) << " failed" << std::endl;
0044 }
0045 return 0;
0046 }