Skip to content
Snippets Groups Projects
Commit c1d1aaab authored by Michael Reuscher's avatar Michael Reuscher
Browse files

asapo ready

parent b9a8dafb
No related branches found
No related tags found
1 merge request!4Python driver and data analysis part
......@@ -8,6 +8,13 @@ OPTION(INSTALL_DOCUMENTATION "Also install the HTML based API documentation (you
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/" "/usr/local/lib/cmake/")
set (ASAPO_SHARED_LIBS ON)
cmake_policy(SET CMP0057 NEW)
find_package (Asapo COMPONENTS Producer)
if (Asapo_FOUND)
message("Using ASAPO")
endif()
include(CheckCXXCompilerFlag)
IF(NOT CMAKE_BUILD_TYPE)
......
......@@ -10,8 +10,11 @@ def create_size_list(length):
# Function to read the configuration from a JSON file
def read_config():
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data_config.json')
def read_config(asapo):
if asapo:
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data_config_asapo.json')
else:
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data_config.json')
with open(config_path, 'r') as file:
d_config = json.load(file)
return d_config
......@@ -62,8 +65,8 @@ def set_arguments_long(da_config, test_data_path):
# Function to create the list of event arguments based on the chosen function
def create_event_list(args, test_data_path):
if args.function == 'long':
e_list = set_arguments_long(read_config(), test_data_path)
e_list = set_arguments_long(read_config(args.asapo), test_data_path)
else:
e_list = set_arguments_various(read_config(), test_data_path, args)
e_list = set_arguments_various(read_config(args.asapo), test_data_path, args)
# Return the final list of event arguments
return e_list
{
"data_config_various":{
"-n": "100",
"-i": "0.1s",
"-N": "99",
"--asapo": "test",
"--beamline": "beamline",
"--beamlineID": "beamlineID"},
"data_config_long":{
"-s": "1024",
"-n": "100",
"-i": "0.1s",
"-N": "4",
"--asapo": "test",
"--beamline": "beamline",
"--beamlineID": "beamlineID"},
"data_config_help":{
"note": "this is only a help an it is never used by the simrunner programm",
"--burstInterval": "event interval in a burst default: 1000000",
"--burstLength": "number of events in a burst default: 0",
"--dataGenerator": "name of the data generator default: random",
"--debugOptions": "give debug output to option parsing default: false",
"-h, --help": "give this help default: false",
"-i, --interval": "event interval default: 1000000000",
"-n, --nEvents": "number of events to create per thread default: 1",
"--noCfgFileRecursion": "do not read config files recursively, must be set before use default: false",
"--noCfgFiles": "do not read the default config files, must be FIRST option default: false",
"--nodeId": "nodeId for object indentification default:",
"--prefixData": "data prepended to output lines default:",
"-s, --size": "block size (only needed by long)",
"--skew": "timing skew between threads, fracton of interval default: 0",
"--startTime": "time point to start generating data default: -9223372036.854776",
"-t, --timingGenerator": "name of the timing generator default: regular",
"-V, --version": "print version and exit sucessfully default: false",
"--writeCfgFile": "write a config file default:"}
}
\ No newline at end of file
......@@ -30,7 +30,9 @@ def parse_arguments():
parser.add_argument('-p', '--testData', type=str, default=main_directory,
help='Folder to store the test data from detector sim default: ./')
parser.add_argument('-a', '--AmountOfSets', type=str, default='23',
help='Amount of Data_Sets, default ist 23')
help='Amount of Data_Sets, default = 23')
parser.add_argument('--asapo', action='store_true',
help='Stream to asapo default = false')
return parser.parse_args()
......
......@@ -51,6 +51,8 @@ def remote_simulation(sim_path, event, output_path, ssh_target, host):
event['-o'] = remote_output
e_list = []
for k, v in event.items():
if k == "--posixDataDir" and args.asapo:
continue
e_list.append(k)
e_list.append(v)
# Construct the command to run the simulation on the remote machine via SSH
......@@ -68,6 +70,8 @@ def local_simulation(sim_path, event, output_path):
event['-o'] = output_path_local
e_list = []
for k, v in event.items():
if k == "--posixDataDir" and args.asapo:
continue
e_list.append(k)
e_list.append(v)
command = [sim_path] + e_list
......@@ -102,11 +106,12 @@ def run(e_dict, main_path):
future = executor.submit(local_simulation, args.sim, e_dict[event], output_path)
futures.append((folder_name, None, future))
# Animierte Anzeige (z.B. sich drehende Röhre)
# animation
animation = ['|', '/', '-', '\\']
animation_index = 0
for folder_name, host, future in futures:
# working animation
while not future.done():
sys.stdout.write('\rWorking ' + animation[animation_index])
sys.stdout.flush()
......
......@@ -68,6 +68,10 @@ if (RDKAFKA_FOUND)
list(APPEND DETSIM_INCLUDES ${RDKAFKA_INCLUDE_DIRS})
list(APPEND DETSIM_OPTIONS ${RDKAFKA_CFLAGS_OTHER})
endif()
if (Asapo_FOUND)
list(APPEND DETSIM_SOURCES outputAsapo.cpp)
list(APPEND DETSIM_LIBS imported::asapo-producer)
endif()
list(REMOVE_DUPLICATES DETSIM_SOURCES)
#list(REMOVE_DUPLICATES DETSIM_INCLUDES)
#list(REMOVE_DUPLICATES DETSIM_OPTIONS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment