From 97f8fd87e84e55866606e9c57b8fc2f85542c332 Mon Sep 17 00:00:00 2001 From: cmoussa1 Date: Thu, 17 Oct 2024 10:10:07 -0700 Subject: [PATCH] t1011: drop use of flux-core job-archive module Problem: t1011-job-archive-interface.t relies on the job-archive module in flux-core which is being considered for removal in flux-framework/flux-core#6378 since flux-accounting now has that capability on its own. Edit the tests that use the job-archive module and just use flux-accounting's fetch-job-records script to fetch inactive job records. --- t/t1011-job-archive-interface.t | 76 +++++++-------------------------- 1 file changed, 15 insertions(+), 61 deletions(-) diff --git a/t/t1011-job-archive-interface.t b/t/t1011-job-archive-interface.t index a2f18ea0..cf7bf080 100755 --- a/t/t1011-job-archive-interface.t +++ b/t/t1011-job-archive-interface.t @@ -5,8 +5,6 @@ test_description='test fetching jobs and updating the fair share values for a gr . $(dirname $0)/sharness.sh DB_PATH=$(pwd)/FluxAccountingTest.db -ARCHIVEDIR=`pwd` -ARCHIVEDB="${ARCHIVEDIR}/jobarchive.db" QUERYCMD="flux python ${SHARNESS_TEST_SRCDIR}/scripts/query.py" NO_JOBS=${SHARNESS_TEST_SRCDIR}/expected/job_usage/no_jobs.expected @@ -15,27 +13,6 @@ test_under_flux 4 job flux setattr log-stderr-level 1 -# wait for job to be stored in job archive -# arg1 - jobid -# arg2 - database path -wait_db() { - local jobid=$(flux job id $1) - local dbpath=$2 - local i=0 - query="select id from jobs;" - while ! ${QUERYCMD} -t 100 ${dbpath} "${query}" | grep $jobid > /dev/null \ - && [ $i -lt 50 ] - do - sleep 0.1 - i=$((i + 1)) - done - if [ "$i" -eq "100" ] - then - return 1 - fi - return 0 -} - # select job records from flux-accounting DB select_job_records() { local dbpath=$1 @@ -70,29 +47,14 @@ test_expect_success 'add some users to the DB' ' flux account add-user --username=user5012 --userid=5012 --bank=account1 --shares=1 ' -test_expect_success 'job-archive: set up config file' ' - cat >archive.toml < records.out && grep "hostname" records.out ' @@ -129,19 +91,15 @@ test_expect_success 'submit some sleep 1 jobs under one user' ' jobid1=$(flux submit -N 1 sleep 1) && jobid2=$(flux submit -N 1 sleep 1) && jobid3=$(flux submit -n 2 -N 2 sleep 1) && - wait_db ${jobid1} ${ARCHIVEDB} && - wait_db ${jobid2} ${ARCHIVEDB} && - wait_db ${jobid3} ${ARCHIVEDB} + flux job wait-event -vt 3 ${jobid1} clean && + flux job wait-event -vt 3 ${jobid2} clean && + flux job wait-event -vt 3 ${jobid3} clean ' test_expect_success 'run fetch-job-records script' ' flux account-fetch-job-records -p ${DB_PATH} ' -test_expect_success 'view job records for a user' ' - flux account -p ${DB_PATH} view-job-records --user $username -' - test_expect_success 'view job records for a user and direct it to a file' ' flux account -p ${DB_PATH} --output-file $(pwd)/test.txt view-job-records --user $username ' @@ -160,9 +118,9 @@ test_expect_success 'submit some sleep 1 jobs under the secondary bank of the sa jobid1=$(flux submit --setattr=system.bank=account2 -N 1 sleep 1) && jobid2=$(flux submit --setattr=system.bank=account2 -N 1 sleep 1) && jobid3=$(flux submit --setattr=system.bank=account2 -n 2 -N 2 sleep 1) && - wait_db ${jobid1} ${ARCHIVEDB} && - wait_db ${jobid2} ${ARCHIVEDB} && - wait_db ${jobid3} ${ARCHIVEDB} + flux job wait-event -vt 3 ${jobid1} clean && + flux job wait-event -vt 3 ${jobid2} clean && + flux job wait-event -vt 3 ${jobid3} clean ' test_expect_success 'run custom job-list script' ' @@ -195,10 +153,6 @@ test_expect_success 'remove flux-accounting DB' ' rm $(pwd)/FluxAccountingTest.db ' -test_expect_success 'job-archive: unload module' ' - flux module unload job-archive -' - test_expect_success 'shut down flux-accounting service' ' flux python -c "import flux; flux.Flux().rpc(\"accounting.shutdown_service\").get()" '