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
8128482a
Commit
8128482a
authored
6 years ago
by
Jonas
Browse files
Options
Downloads
Patches
Plain Diff
Imports fixed for CastorScript.py
parent
df680e2e
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!17
Resolve "test ERS implementation"
,
!16
Resolve "Implement folder structure"
Pipeline
#721295
passed
6 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Script/CastorScript.py
+13
-10
13 additions, 10 deletions
Script/CastorScript.py
Script/CastorScript/__init__.py
+0
-0
0 additions, 0 deletions
Script/CastorScript/__init__.py
Script/cs/Tools/utils.py
+77
-0
77 additions, 0 deletions
Script/cs/Tools/utils.py
with
90 additions
and
10 deletions
Script/CastorScript.py
+
13
−
10
View file @
8128482a
...
...
@@ -10,15 +10,18 @@ import datetime
import
signal
import
logging
import
logging.handlers
from
utils
import
set_log_level
,
formatter
from
ManagerThread
import
ManagerThread
from
CopyThread
import
CopyThread
from
DeleteThread
import
DeleteThread
from
CheckThread
import
CheckThread
from
DdmMonitoringThread
import
DdmMonitoringThread
import
Conf
import
Constants
#Imports of script
from
cs.Tools.utils
import
set_log_level
,
formatter
from
cs.Threads.ManagerThread
import
ManagerThread
from
cs.Threads.CopyThread
import
CopyThread
from
cs.Threads.DeleteThread
import
DeleteThread
from
cs.Threads.CheckThread
import
CheckThread
from
cs.Threads.DdmMonitoringThread
import
DdmMonitoringThread
import
cs.Tools.Conf
as
Conf
import
cs.Tools.Constants
as
Constants
#From cm_setup Script
import
mailinglogger
##### Global flag for exit #####
...
...
@@ -302,7 +305,7 @@ def checkDB(db, logger, dblogger, parser, conf):
if
not
db
and
conf
.
connection
:
logger
.
info
(
'
Connecting to Metadata Database...
'
)
try
:
import
Database
import
cs.Tools.Libraries.Database
as
Database
db
=
Database
.
Database
(
conf
,
dblogger
,
parser
)
logger
.
info
(
'
Connection to Metadata Database succeeded
'
)
except
Exception
as
ex
:
...
...
This diff is collapsed.
Click to expand it.
Script/CastorScript/__init__.py
deleted
100644 → 0
+
0
−
0
View file @
df680e2e
This diff is collapsed.
Click to expand it.
Script/cs/Tools/utils.py
0 → 100644
+
77
−
0
View file @
8128482a
import
logging
import
zlib
import
ctypes
import
time
import
datetime
#### Set Log severity level #####
def
set_log_level
(
level
,
logger
):
level
=
level
.
upper
()
levelmap
=
{
'
DEBUG
'
:
logging
.
DEBUG
,
'
INFO
'
:
logging
.
INFO
,
'
WARNING
'
:
logging
.
WARNING
,
'
ERROR
'
:
logging
.
ERROR
,
'
CRITICAL
'
:
logging
.
CRITICAL
}
logger
.
setLevel
(
levelmap
[
level
])
formatter
=
logging
.
Formatter
(
'
%(asctime)s %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s
'
)
def
gettid
():
#This is linux specific ...
SYS_gettid
=
186
libc
=
ctypes
.
cdll
.
LoadLibrary
(
'
libc.so.6
'
)
tid
=
libc
.
syscall
(
SYS_gettid
)
return
tid
def
thread_id_string
():
import
threading
me
=
threading
.
currentThread
()
return
'
%s TID: %d
'
%
(
me
.
getName
(),
gettid
())
def
adler32
(
filename
):
BS
=
1024
*
1024
f
=
open
(
filename
,
'
rb
'
)
ck
=
1
while
True
:
data
=
f
.
read
(
BS
)
if
not
data
:
break
ck
=
zlib
.
adler32
(
data
,
ck
)
return
(
'
%x
'
%
ctypes
.
c_uint
(
ck
).
value
).
zfill
(
8
)
def
get_tx_bytes
(
device
):
with
open
(
'
/proc/net/dev
'
,
'
r
'
)
as
f
:
lines
=
f
.
readlines
()
device_stat
=
next
(
l
for
l
in
lines
if
device
in
l
)
return
int
(
device_stat
.
split
()[
9
])
def
get_bw
(
device
,
interval
=
1
):
if
not
device
:
return
-
1
tx_bytes_0
=
get_tx_bytes
(
device
)
t0
=
datetime
.
datetime
.
now
()
time
.
sleep
(
interval
)
tdiff
=
(
datetime
.
datetime
.
now
()
-
t0
).
total_seconds
()
bdiff
=
get_tx_bytes
(
device
)
-
tx_bytes_0
if
bdiff
<
0
:
# Wrap up
return
-
1
return
1.
*
bdiff
/
tdiff
/
1000
/
1000
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