Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
7c6de4ee
Commit
7c6de4ee
authored
Aug 18, 2017
by
Eric Cano
Browse files
Added timing logs to Scheduler::reportDriveStatus().
parent
129b6d00
Changes
6
Hide whitespace changes
Inline
Side-by-side
scheduler/Scheduler.cpp
View file @
7c6de4ee
...
...
@@ -379,9 +379,15 @@ void Scheduler::setDesiredDriveState(const common::dataStructures::SecurityIdent
//------------------------------------------------------------------------------
// setDesiredDriveState
//------------------------------------------------------------------------------
void
Scheduler
::
reportDriveStatus
(
const
common
::
dataStructures
::
DriveInfo
&
driveInfo
,
common
::
dataStructures
::
MountType
type
,
common
::
dataStructures
::
DriveStatus
status
)
{
void
Scheduler
::
reportDriveStatus
(
const
common
::
dataStructures
::
DriveInfo
&
driveInfo
,
common
::
dataStructures
::
MountType
type
,
common
::
dataStructures
::
DriveStatus
status
,
log
::
LogContext
&
lc
)
{
// TODO: mount type should be transmitted too.
utils
::
Timer
t
;
m_db
.
reportDriveStatus
(
driveInfo
,
type
,
status
,
time
(
NULL
));
auto
schedulerDbTime
=
t
.
secs
();
log
::
ScopedParamContainer
spc
(
lc
);
spc
.
add
(
"drive"
,
driveInfo
.
driveName
)
.
add
(
"schedulerDbTime"
,
schedulerDbTime
);
lc
.
log
(
log
::
INFO
,
"In Scheduler::reportDriveStatus(): success."
);
}
//------------------------------------------------------------------------------
...
...
scheduler/Scheduler.hpp
View file @
7c6de4ee
...
...
@@ -227,7 +227,7 @@ public:
* error encountered by the drive.
*/
void
reportDriveStatus
(
const
common
::
dataStructures
::
DriveInfo
&
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
type
,
cta
::
common
::
dataStructures
::
DriveStatus
status
);
cta
::
common
::
dataStructures
::
DriveStatus
status
,
log
::
LogContext
&
lc
);
/**
* Dumps the states of all drives for display
...
...
scheduler/SchedulerTest.cpp
View file @
7c6de4ee
...
...
@@ -437,8 +437,8 @@ TEST_P(SchedulerTest, archive_and_retrieve_new_file) {
std
::
unique_ptr
<
cta
::
TapeMount
>
mount
;
// This first initialization is normally done by the dataSession function.
cta
::
common
::
dataStructures
::
DriveInfo
driveInfo
=
{
driveName
,
"myHost"
,
s_libraryName
};
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Up
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
lc
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Up
,
lc
);
mount
.
reset
(
scheduler
.
getNextMount
(
s_libraryName
,
"drive0"
,
lc
).
release
());
ASSERT_NE
((
cta
::
TapeMount
*
)
NULL
,
mount
.
get
());
ASSERT_EQ
(
cta
::
common
::
dataStructures
::
MountType
::
Archive
,
mount
.
get
()
->
getMountType
());
...
...
tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp
View file @
7c6de4ee
...
...
@@ -99,7 +99,7 @@ schedule:
downUpTransition
=
true
;
// We wait a bit before polling the scheduler again.
// TODO: parametrize the duration?
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
lc
);
sleep
(
5
);
}
else
{
break
;
...
...
@@ -107,7 +107,7 @@ schedule:
}
catch
(
cta
::
Scheduler
::
NoSuchDrive
&
e
)
{
// The object store does not even know about this drive. We will report our state
// (default status is down).
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
lc
);
}
}
// If we get here after seeing a down desired state, we are transitioning from
...
...
@@ -117,7 +117,7 @@ schedule:
castor
::
tape
::
tapeserver
::
daemon
::
EmptyDriveProbe
emptyDriveProbe
(
m_log
,
m_driveConfig
,
m_sysWrapper
);
lc
.
log
(
cta
::
log
::
INFO
,
"Transition from down to up detected. Will check if a tape is in the drive."
);
if
(
!
emptyDriveProbe
.
driveIsEmpty
())
{
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
lc
);
cta
::
common
::
dataStructures
::
SecurityIdentity
securityIdentity
;
m_scheduler
.
setDesiredDriveState
(
securityIdentity
,
m_driveConfig
.
unitName
,
false
,
false
,
lc
);
lc
.
log
(
cta
::
log
::
ERR
,
"A tape was detected in the drive. Putting the drive back down."
);
...
...
@@ -135,7 +135,7 @@ schedule:
localParams
.
add
(
"errorMessage"
,
e
.
getMessageValue
());
lc
.
log
(
cta
::
log
::
ERR
,
"Error while scheduling new mount. Putting the drive down. Stack trace follows."
);
lc
.
logBacktrace
(
cta
::
log
::
ERR
,
e
.
backtrace
());
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
lc
);
cta
::
common
::
dataStructures
::
SecurityIdentity
cliId
;
m_scheduler
.
setDesiredDriveState
(
cliId
,
m_driveConfig
.
unitName
,
false
,
false
,
lc
);
return
MARK_DRIVE_AS_DOWN
;
...
...
@@ -143,7 +143,7 @@ schedule:
// No mount to be done found, that was fast...
if
(
!
tapeMount
.
get
())
{
lc
.
log
(
cta
::
log
::
DEBUG
,
"No new mount found. (sleeping 10 seconds)"
);
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Up
);
m_scheduler
.
reportDriveStatus
(
m_driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Up
,
lc
);
sleep
(
10
);
goto
schedule
;
// return MARK_DRIVE_AS_UP;
...
...
tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
View file @
7c6de4ee
...
...
@@ -433,7 +433,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayRecall) {
driveInfo
.
logicalLibrary
=
driveConfig
.
logicalLibrary
;
driveInfo
.
host
==
"host"
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
logContext
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
,
logContext
);
// 7) Create the data transfer session
...
...
@@ -626,7 +626,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongRecall) {
driveInfo
.
logicalLibrary
=
driveConfig
.
logicalLibrary
;
driveInfo
.
host
==
"host"
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
logContext
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
,
logContext
);
// 7) Create the data transfer session
...
...
@@ -829,7 +829,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionRAORecall) {
driveInfo
.
driveName
=
driveConfig
.
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
rawLibrarySlot
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
logContext
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
,
logContext
);
// 7) Create the data transfer session
...
...
@@ -1003,7 +1003,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionNoSuchDrive) {
driveInfo
.
logicalLibrary
=
driveConfig
.
logicalLibrary
;
driveInfo
.
host
==
"host"
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
logContext
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
,
logContext
);
// 8) Create the data transfer session
...
...
@@ -1147,7 +1147,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionFailtoMount) {
driveInfo
.
logicalLibrary
=
driveConfig
.
logicalLibrary
;
driveInfo
.
host
==
"host"
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
logContext
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
,
logContext
);
// 8) Create the data transfer session
...
...
@@ -1274,7 +1274,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayMigration) {
driveInfo
.
logicalLibrary
=
driveConfig
.
logicalLibrary
;
driveInfo
.
host
==
"host"
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
logContext
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
,
logContext
);
// Create the data transfer session
...
...
@@ -1416,7 +1416,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionMissingFilesMigration) {
driveInfo
.
logicalLibrary
=
driveConfig
.
logicalLibrary
;
driveInfo
.
host
==
"host"
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
logContext
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
,
logContext
);
// Create the data transfer session
...
...
@@ -1552,7 +1552,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullMigration) {
driveInfo
.
logicalLibrary
=
driveConfig
.
logicalLibrary
;
driveInfo
.
host
==
"host"
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
logContext
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
,
logContext
);
// Create the data transfer session
...
...
@@ -1702,7 +1702,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullOnFlushMigration) {
driveInfo
.
logicalLibrary
=
driveConfig
.
logicalLibrary
;
driveInfo
.
host
==
"host"
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
logContext
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
,
logContext
);
// Create the data transfer session
...
...
tapeserver/daemon/DriveHandler.cpp
View file @
7c6de4ee
...
...
@@ -946,7 +946,7 @@ int DriveHandler::runChild() {
driveInfo
.
driveName
=
m_configLine
.
unitName
;
driveInfo
.
logicalLibrary
=
m_configLine
.
logicalLibrary
;
driveInfo
.
host
=
hostname
;
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
lc
);
cta
::
common
::
dataStructures
::
SecurityIdentity
securityIdentity
;
scheduler
.
setDesiredDriveState
(
securityIdentity
,
m_configLine
.
unitName
,
false
,
false
,
lc
);
return
castor
::
tape
::
tapeserver
::
daemon
::
Session
::
MARK_DRIVE_AS_DOWN
;
...
...
@@ -972,7 +972,7 @@ int DriveHandler::runChild() {
driveInfo
.
driveName
=
m_configLine
.
unitName
;
driveInfo
.
logicalLibrary
=
m_configLine
.
logicalLibrary
;
driveInfo
.
host
=
hostname
;
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
,
lc
);
cta
::
common
::
dataStructures
::
SecurityIdentity
securityIdentity
;
scheduler
.
setDesiredDriveState
(
securityIdentity
,
m_configLine
.
unitName
,
false
,
false
,
lc
);
return
castor
::
tape
::
tapeserver
::
daemon
::
Session
::
MARK_DRIVE_AS_DOWN
;
...
...
@@ -1065,7 +1065,7 @@ int DriveHandler::runChild() {
driveInfo
.
driveName
=
m_configLine
.
unitName
;
driveInfo
.
logicalLibrary
=
m_configLine
.
logicalLibrary
;
driveInfo
.
host
=
hostname
;
scheduler
.
reportDriveStatus
(
driveInfo
,
common
::
dataStructures
::
MountType
::
NoMount
,
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
reportDriveStatus
(
driveInfo
,
common
::
dataStructures
::
MountType
::
NoMount
,
common
::
dataStructures
::
DriveStatus
::
Down
,
lc
);
cta
::
common
::
dataStructures
::
SecurityIdentity
securityIdentity
;
scheduler
.
setDesiredDriveState
(
securityIdentity
,
m_configLine
.
unitName
,
false
/* down */
,
false
/* no force down*/
,
lc
);
}
catch
(
cta
::
exception
::
Exception
&
ex
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment