Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CastorScript
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
atlas-tdaq-software
CastorScript
Commits
2ab29f41
Commit
2ab29f41
authored
2 years ago
by
Fabrice Le Goff
Browse files
Options
Downloads
Patches
Plain Diff
make DB stuff in main thread conditionned to DB config
parent
69620f77
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Script/CastorScript.py
+19
-17
19 additions, 17 deletions
Script/CastorScript.py
with
19 additions
and
17 deletions
Script/CastorScript.py
+
19
−
17
View file @
2ab29f41
...
...
@@ -115,7 +115,6 @@ if config.EmailLogList:
LogConfig
.
enable_mail_logging
(
config
)
logger
=
LogConfig
.
enable_file_logging
(
"
main
"
,
"
main.log
"
,
config
)
dblogger
=
LogConfig
.
enable_file_logging
(
"
database
"
,
"
database.log
"
,
config
)
# Load filename parser
try
:
...
...
@@ -166,9 +165,11 @@ signal.signal(signal.SIGINT, main_exit)
logger
.
info
(
thread_id_string
())
# Connect to database
db
=
None
db
=
checkDB
(
db
,
logger
,
dblogger
,
filename_parser
,
config
)
db_last_connection_time
=
time
()
if
config
.
DBURL
:
dblogger
=
LogConfig
.
enable_file_logging
(
"
database
"
,
"
database.log
"
,
config
)
db
=
None
db
=
checkDB
(
db
,
logger
,
dblogger
,
filename_parser
,
config
)
db_last_connection_time
=
time
()
# Setup Kerberos if needed
if
config
.
Keytab
:
...
...
@@ -193,19 +194,20 @@ if config.DdmMonitoringEnabled:
while
not
exit_event
.
is_set
():
logger
.
debug
(
'
checking DB connection
'
)
db
=
checkDB
(
db
,
logger
,
dblogger
,
filename_parser
,
config
)
# Always keep a fresh connection
if
db
and
(
time
()
-
db_last_connection_time
)
>
config
.
DBReconnectTimeout
:
logger
.
info
(
'
refreshing database connection
'
)
with
db_lock
:
try
:
db
.
Reconnect
()
except
Exception
as
ex
:
logger
.
error
(
'
error connecting to DB: %s
'
,
str
(
ex
))
db
=
None
db_last_connection_time
=
time
()
if
config
.
DBURL
:
logger
.
debug
(
'
checking DB connection
'
)
db
=
checkDB
(
db
,
logger
,
dblogger
,
filename_parser
,
config
)
# Always keep a fresh connection
if
db
and
(
time
()
-
db_last_connection_time
)
>
config
.
DBReconnectTimeout
:
logger
.
info
(
'
refreshing database connection
'
)
with
db_lock
:
try
:
db
.
Reconnect
()
except
Exception
as
ex
:
logger
.
error
(
'
error connecting to DB: %s
'
,
str
(
ex
))
db
=
None
db_last_connection_time
=
time
()
# Update KRB token, if needed:
if
config
.
Keytab
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment