Commit fe06c530 authored by Volodymyr Yurchenko's avatar Volodymyr Yurchenko
Browse files

Parametrize duration of sleep between polling the drive state in down-up transition loop

parent 0f2e43d0
Pipeline #4831458 waiting for manual action with stages
in 46 minutes and 59 seconds
......@@ -152,6 +152,11 @@ struct DataTransferConfig {
*/
time_t wdIdleSessionTimer;
/**
* Time to wait after scheduling came up idle
*/
time_t wdDownUpTransitionTimeout;
/**
* Constructor that sets all integer member-variables to 0 and all string
* member-variables to the empty string.
......
......@@ -128,8 +128,7 @@ castor::tape::tapeserver::daemon::DataTransferSession::execute() {
cta::common::dataStructures::DriveStatus::Down, lc);
// We wait a bit before polling the scheduler again.
// TODO: parametrize the duration?
sleep(5);
sleep(m_dataTransferConfig.wdDownUpTransitionTimeout);
} else {
break;
}
......
......@@ -199,6 +199,8 @@ timeout is exceeded, the session will be terminated.
.TP
.B taped WatchdogIdleSessionTimer \fI10\fR
Maximum time to wait after scheduling came up idle, in seconds.
.B taped WatchdogDownUpTransitionTimeout \fI5\fR
Maximum time to wait between polling the drive changing it's state from down to up, in seconds.
.SH ENVIRONMENT
.TP
......
......@@ -1013,6 +1013,7 @@ int DriveHandler::runChild() {
dataTransferConfig.useEncryption = m_tapedConfig.useEncryption.value() == "yes" ? true : false;
dataTransferConfig.externalEncryptionKeyScript = m_tapedConfig.externalEncryptionKeyScript.value();
dataTransferConfig.wdIdleSessionTimer = m_tapedConfig.wdIdleSessionTimer.value();
dataTransferConfig.wdDownUpTransitionTimeout = m_tapedConfig.wdDownUpTransitionTimeout.value();
m_stateChangeTimeouts[session::SessionState::Checking] = std::chrono::duration_cast<Timeout>(
std::chrono::minutes(m_tapedConfig.wdCheckMaxSecs.value()));
m_stateChangeTimeouts[session::SessionState::Scheduling] = std::chrono::duration_cast<Timeout>(
......
......@@ -88,8 +88,9 @@ public:
private:
void run() override {
// Wait for 1 second - the drive handler should be configured by that time
sleep(1);
while (true) {
// sleep(1);
std::unique_ptr<Report> currentReport(m_fifo.pop());
if (nullptr == currentReport) {
break;
......@@ -160,7 +161,6 @@ public:
std::unique_ptr<cta::SchedulerDatabase> m_db;
std::unique_ptr<cta::catalogue::Catalogue> m_catalogue;
std::unique_ptr<cta::Scheduler> m_scheduler;
// cta::log::StdoutLogger m_dummyLog;
cta::log::StringLogger m_dummyLog;
cta::log::LogContext m_lc;
cta::tape::daemon::TpconfigLine m_driveConfig;
......@@ -218,6 +218,8 @@ public:
"taped BufferCount 1\n"
"taped TpConfigPath ");
m_ctaConf.stringAppend(m_tpConfig.path());
m_ctaConf.stringAppend("\n"
"taped WatchdogDownUpTransitionTimeout 0");
m_completeConfig = cta::tape::daemon::TapedConfiguration::createFromCtaConf(m_ctaConf.path());
m_socketPair = std::make_unique<cta::server::SocketPair>();
......@@ -250,7 +252,6 @@ public:
// Listen for any possible messages from the parent process
// If it is a state change, echo it back to parent
// This is used by DriveHandlerTest unit tests
try {
serializers::WatchdogMessage message;
m_lc.log(cta::log::DEBUG, "DriveHandlerTest::reportHeartbeat(): Receive Message");
......@@ -294,7 +295,6 @@ TEST_P(DriveHandlerTest, TriggerCleanerSessionAtTheEndOfSession) {
cta::tape::daemon::ProcessManager processManager(m_lc);
auto driveHandler = std::make_unique<DriveHandler>(m_completeConfig, m_driveConfig, processManager, m_mockProxy);
processManager.addHandler(std::move(driveHandler));
// Get back the drive handler and let the reporter send messages
......
......@@ -114,6 +114,7 @@ TapedConfiguration TapedConfiguration::createFromCtaConf(
ret.raoLtoOptions.setFromConfigurationFile(cf,generalConfigPath);
// Watchdog: parameters for timeouts in various situations.
ret.wdIdleSessionTimer.setFromConfigurationFile(cf, generalConfigPath);
ret.wdDownUpTransitionTimeout.setFromConfigurationFile(cf, generalConfigPath);
ret.wdMountMaxSecs.setFromConfigurationFile(cf, generalConfigPath);
ret.wdNoBlockMoveMaxSecs.setFromConfigurationFile(cf, generalConfigPath);
ret.wdScheduleMaxSecs.setFromConfigurationFile(cf, generalConfigPath);
......
......@@ -134,6 +134,9 @@ struct TapedConfiguration {
/// Time to wait after scheduling came up idle
cta::SourcedParameter<time_t> wdIdleSessionTimer{
"taped", "WatchdogIdleSessionTimer", 10, "Compile time default"};
/// Time to wait between polling the drive changing it's state from down to up
cta::SourcedParameter<time_t> wdDownUpTransitionTimeout{
"taped", "WatchdogDownUpTransitionTimeout", 5, "Compile time default"};
//----------------------------------------------------------------------------
// The central storage access configuration
//----------------------------------------------------------------------------
......
......@@ -180,3 +180,6 @@ taped externalFreeDiskSpaceScript /usr/local/bin/cta-get-free-disk-space.sh
#
# Maximum time to wait after scheduling came up idle, in seconds.
# taped WatchdogIdleSessionTimer 10
#
# Maximum time to wait between polling the drive changing it's state from down to up, in seconds.
# taped WatchdogDownUpTransitionTimeout 5
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment