From 82f65052ef8fdc2055ca3e23e2426c11e3595174 Mon Sep 17 00:00:00 2001 From: Sergey Yakubov <sergey.yakubov@desy.de> Date: Wed, 2 Oct 2019 16:49:54 +0200 Subject: [PATCH] increase timeout for pipeline tests --- examples/pipeline/in_to_out/check_linux.sh | 4 ++-- examples/pipeline/in_to_out/check_windows.bat | 4 ++-- examples/pipeline/in_to_out/in_to_out.cpp | 10 ++++++---- examples/pipeline/in_to_out_python/check_linux.sh | 3 ++- examples/pipeline/in_to_out_python/check_windows.bat | 3 ++- examples/pipeline/in_to_out_python/in_to_out.py | 5 +++-- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/examples/pipeline/in_to_out/check_linux.sh b/examples/pipeline/in_to_out/check_linux.sh index cef2a59dd..55199387c 100644 --- a/examples/pipeline/in_to_out/check_linux.sh +++ b/examples/pipeline/in_to_out/check_linux.sh @@ -56,7 +56,7 @@ done sleep 1 -$1 127.0.0.1:8400 $source_path $beamtime_id $stream_in $stream_out $token 2 1000 1 > out +$1 127.0.0.1:8400 $source_path $beamtime_id $stream_in $stream_out $token 2 1000 25000 1 > out cat out cat out | grep "Processed 3 file(s)" cat out | grep "Sent 3 file(s)" @@ -67,7 +67,7 @@ cat ${receiver_folder}/file1_${stream_out} | grep hello1 cat ${receiver_folder}/file2_${stream_out} | grep hello2 cat ${receiver_folder}/file3_${stream_out} | grep hello3 -$1 127.0.0.1:8400 $source_path $beamtime_id $stream_in $stream_out2 $token 2 1000 0 > out2 +$1 127.0.0.1:8400 $source_path $beamtime_id $stream_in $stream_out2 $token 2 1000 25000 0 > out2 cat out2 test ! -f ${receiver_folder}/file1_${stream_out2} echo "db.data.find({"_id":1})" | mongo ${outdatabase_name2} | tee /dev/stderr | grep ./file1 diff --git a/examples/pipeline/in_to_out/check_windows.bat b/examples/pipeline/in_to_out/check_windows.bat index 30a6407fa..b4ebe9fbf 100644 --- a/examples/pipeline/in_to_out/check_windows.bat +++ b/examples/pipeline/in_to_out/check_windows.bat @@ -36,7 +36,7 @@ echo hello2 > file2 echo hello3 > file3 -"%1" 127.0.0.1:8400 %source_path% %beamtime_id% %stream_in% %stream_out% %token% 2 1000 1 > out +"%1" 127.0.0.1:8400 %source_path% %beamtime_id% %stream_in% %stream_out% %token% 2 1000 25000 1 > out type out findstr /I /L /C:"Processed 3 file(s)" out || goto :error findstr /I /L /C:"Sent 3 file(s)" out || goto :error @@ -48,7 +48,7 @@ findstr /I /L /C:"hello2" %receiver_folder%\file2_%stream_out% || goto :error findstr /I /L /C:"hello3" %receiver_folder%\file3_%stream_out% || goto :error -"%1" 127.0.0.1:8400 %source_path% %beamtime_id% %stream_in% %stream_out2% %token% 2 1000 0 > out2 +"%1" 127.0.0.1:8400 %source_path% %beamtime_id% %stream_in% %stream_out2% %token% 2 1000 25000 0 > out2 type out2 findstr /I /L /C:"Processed 3 file(s)" out2 || goto :error findstr /I /L /C:"Sent 3 file(s)" out2 || goto :error diff --git a/examples/pipeline/in_to_out/in_to_out.cpp b/examples/pipeline/in_to_out/in_to_out.cpp index ac2ee3e5c..0a15cac5f 100644 --- a/examples/pipeline/in_to_out/in_to_out.cpp +++ b/examples/pipeline/in_to_out/in_to_out.cpp @@ -33,6 +33,7 @@ struct Args { std::string stream_out; std::string token; int timeout_ms; + int timeout_ms_producer; int nthreads; bool transfer_data; }; @@ -206,7 +207,7 @@ void WaitProducerThreadsFinished(const Args& args, int nfiles) { } std::this_thread::sleep_for(std::chrono::milliseconds(100)); elapsed_ms += 100; - if (elapsed_ms > args.timeout_ms) { + if (elapsed_ms > args.timeout_ms_producer) { std::cerr << "Stream out exit on timeout " << std::endl; break; } @@ -218,9 +219,9 @@ void WaitProducerThreadsFinished(const Args& args, int nfiles) { int main(int argc, char* argv[]) { asapo::ExitAfterPrintVersionIfNeeded("GetNext Broker Example", argc, argv); Args args; - if (argc != 10) { + if (argc != 11) { std::cout << "Usage: " + std::string{argv[0]} - + " <server> <files_path> <beamtime_id> <stream_in> <stream_out> <nthreads> <token> <timeout ms> <transfer data>" + + " <server> <files_path> <beamtime_id> <stream_in> <stream_out> <nthreads> <token> <timeout ms> <timeout ms producer> <transfer data>" << std::endl; exit(EXIT_FAILURE); @@ -233,7 +234,8 @@ int main(int argc, char* argv[]) { args.token = std::string{argv[6]}; args.nthreads = atoi(argv[7]); args.timeout_ms = atoi(argv[8]); - args.transfer_data = atoi(argv[9]) == 1; + args.timeout_ms_producer = atoi(argv[9]); + args.transfer_data = atoi(argv[10]) == 1; auto producer = CreateProducer(args); files_sent = 0; diff --git a/examples/pipeline/in_to_out_python/check_linux.sh b/examples/pipeline/in_to_out_python/check_linux.sh index 9feb505bf..2d3b4a844 100644 --- a/examples/pipeline/in_to_out_python/check_linux.sh +++ b/examples/pipeline/in_to_out_python/check_linux.sh @@ -6,6 +6,7 @@ stream_in=detector stream_out=stream timeout=2 +timeout_producer=25 nthreads=4 indatabase_name=${beamtime_id}_${stream_in} @@ -60,7 +61,7 @@ sleep 1 export PYTHONPATH=$2:$3:${PYTHONPATH} -$1 $4 127.0.0.1:8400 $source_path $beamtime_id $stream_in $stream_out $token $timeout $nthreads 1 > out +$1 $4 127.0.0.1:8400 $source_path $beamtime_id $stream_in $stream_out $token $timeout $timeout_producer $nthreads 1 > out cat out cat out | grep "Processed 3 file(s)" cat out | grep "Sent 3 file(s)" diff --git a/examples/pipeline/in_to_out_python/check_windows.bat b/examples/pipeline/in_to_out_python/check_windows.bat index a4d705c93..1fda1fe94 100644 --- a/examples/pipeline/in_to_out_python/check_windows.bat +++ b/examples/pipeline/in_to_out_python/check_windows.bat @@ -17,6 +17,7 @@ SET receiver_folder="%receiver_root_folder%\%beamline%\%beamtime_id%" SET mongo_exe="c:\Program Files\MongoDB\Server\3.6\bin\mongo.exe" SET timeout=2 +SET timeout_producer=25 SET nthreads=4 c:\opt\consul\nomad run discovery.nmd @@ -37,7 +38,7 @@ echo hello3 > file3 set PYTHONPATH=%2;%3 -"%1" "%4" 127.0.0.1:8400 %source_path% %beamtime_id% %stream_in% %stream_out% %token% %timeout% %nthreads% 1 > out +"%1" "%4" 127.0.0.1:8400 %source_path% %beamtime_id% %stream_in% %stream_out% %token% %timeout% %timeout_producer% %nthreads% 1 > out type out findstr /I /L /C:"Processed 3 file(s)" out || goto :error diff --git a/examples/pipeline/in_to_out_python/in_to_out.py b/examples/pipeline/in_to_out_python/in_to_out.py index c8d5aed3f..e2e2d6031 100644 --- a/examples/pipeline/in_to_out_python/in_to_out.py +++ b/examples/pipeline/in_to_out_python/in_to_out.py @@ -29,8 +29,9 @@ def wait_send(n_files, timeout_s): break time.sleep(1) -source, path, beamtime,stream_in, stream_out, token, timeout_s,nthreads, transfer_data = sys.argv[1:] +source, path, beamtime,stream_in, stream_out, token, timeout_s,timeout_s_producer,nthreads, transfer_data = sys.argv[1:] timeout_s=int(timeout_s) +timeout_s_producer=int(timeout_s_producer) nthreads=int(nthreads) transfer_data=int(transfer_data)>0 @@ -60,7 +61,7 @@ while True: break -wait_send(n_recv,timeout_s) +wait_send(n_recv,timeout_s_producer) print ("Processed "+str(n_recv)+" file(s)") print ("Sent "+str(n_send)+" file(s)") -- GitLab