From 2d779014cea6f0150293a427342ae0b1d40dfe2e Mon Sep 17 00:00:00 2001 From: Cedric CAFFY <cedric.caffy@cern.ch> Date: Fri, 22 Nov 2019 16:37:27 +0100 Subject: [PATCH] Set the status as RJS_Failed of Retrieve Failed jobs after report success before being queued in the RetrieveQueueFailed --- scheduler/OStoreDB/OStoreDB.cpp | 12 ++++++++++++ scheduler/OStoreDB/OStoreDB.hpp | 1 + scheduler/SchedulerDatabase.hpp | 1 + 3 files changed, 14 insertions(+) diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index e1f4d7013d..f86b8d6640 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -1090,6 +1090,7 @@ void OStoreDB::setRetrieveJobBatchReportedToUser(std::list<cta::SchedulerDatabas for(auto &j : jobsBatch) { switch(j->reportType) { case SchedulerDatabase::RetrieveJob::ReportType::FailureReport: { + j->fail(); auto &vid = j->archiveFile.tapeFiles.at(j->selectedCopyNb).vid; failedQueues[vid].push_back(FailedJobToQueue{ castFromSchedDBJob(j) }); break; @@ -5306,4 +5307,15 @@ void OStoreDB::RetrieveJob::asyncSetSuccessful() { } } +void OStoreDB::RetrieveJob::fail() { + if(!m_jobOwned) + throw JobNotOwned("In OStoreDB::RetrieveJob::failReport: cannot fail a job not owned"); + + // Lock the retrieve request. Change the status of the job. + objectstore::ScopedExclusiveLock rrl(m_retrieveRequest); + m_retrieveRequest.fetch(); + m_retrieveRequest.setJobStatus(this->selectedCopyNb,serializers::RetrieveJobStatus::RJS_Failed); + m_retrieveRequest.commit(); +} + } // namespace cta diff --git a/scheduler/OStoreDB/OStoreDB.hpp b/scheduler/OStoreDB/OStoreDB.hpp index 53f8e540db..2a4dfa6fb6 100644 --- a/scheduler/OStoreDB/OStoreDB.hpp +++ b/scheduler/OStoreDB/OStoreDB.hpp @@ -255,6 +255,7 @@ public: void failTransfer(const std::string& failureReason, log::LogContext& lc) override; void failReport(const std::string& failureReason, log::LogContext& lc) override; void abort(const std::string& abortReason, log::LogContext &lc) override; + void fail() override; virtual ~RetrieveJob() override; private: // Can be instantiated from a mount (queue to transfer) or a report queue diff --git a/scheduler/SchedulerDatabase.hpp b/scheduler/SchedulerDatabase.hpp index 9b2131cce4..18f37a0903 100644 --- a/scheduler/SchedulerDatabase.hpp +++ b/scheduler/SchedulerDatabase.hpp @@ -402,6 +402,7 @@ public: virtual void failTransfer(const std::string &failureReason, log::LogContext &lc) = 0; virtual void failReport(const std::string &failureReason, log::LogContext &lc) = 0; virtual void abort(const std::string &abortReason, log::LogContext &lc) = 0; + virtual void fail() = 0; virtual ~RetrieveJob() {} private: }; -- GitLab