Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
982b1b57
Commit
982b1b57
authored
13 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Task #3064: Made rtlogsender robust against non-conforming loglines
parent
18ff0e3c
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
MAC/APL/CEPCU/src/CEPlogProcessor/rtlogsender.py
+9
-3
9 additions, 3 deletions
MAC/APL/CEPCU/src/CEPlogProcessor/rtlogsender.py
with
9 additions
and
3 deletions
MAC/APL/CEPCU/src/CEPlogProcessor/rtlogsender.py
+
9
−
3
View file @
982b1b57
...
...
@@ -21,7 +21,7 @@ def extractDateTime( logline ):
def
convertDateTime
(
dt
):
if
dt
is
None
:
return
now
()
return
None
y
,
m
,
d
=
dt
[
0
].
split
(
"
-
"
)
H
,
M
,
S
=
dt
[
1
].
split
(
"
:
"
)
...
...
@@ -33,6 +33,9 @@ def convertDateTime( dt ):
return
datetime
.
datetime
(
int
(
y
),
int
(
m
),
int
(
d
),
int
(
H
),
int
(
M
),
int
(
S
),
int
(
float
(
F
)
*
1000
)
)
def
sleepUntil
(
dt
):
if
dt
is
None
:
return
sleeptime
=
totalseconds
(
dt
-
now
())
if
sleeptime
>
0
:
time
.
sleep
(
sleeptime
)
...
...
@@ -43,16 +46,19 @@ starttime = None
for
l
in
sys
.
stdin
:
try
:
dt
=
convertDateTime
(
extractDateTime
(
l
)
)
if
offset
is
None
:
if
dt
is
None
:
wait
=
None
elif
offset
is
None
:
offset
=
dt
starttime
=
now
()
wait
=
datetime
.
timedelta
()
else
:
wait
=
dt
-
offset
if
totalseconds
(
wait
)
>
0
:
if
wait
is
not
None
and
totalseconds
(
wait
)
>
0
:
sleepUntil
(
starttime
+
wait
)
except
ValueError
:
continue
print
l
.
rstrip
()
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