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
ca6ab66e
Commit
ca6ab66e
authored
5 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
SW-720
: refactoring logging lines
parent
20974630
No related branches found
No related tags found
1 merge request
!6
Import cobalt2 into lofar4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/SpecificationServices/lib/specification_service.py
+11
-11
11 additions, 11 deletions
SAS/SpecificationServices/lib/specification_service.py
with
11 additions
and
11 deletions
SAS/SpecificationServices/lib/specification_service.py
+
11
−
11
View file @
ca6ab66e
...
...
@@ -127,7 +127,7 @@ def _parse_activity_paths(spec):
paths
[
activikey
]
=
path
for
key
in
list
(
paths
.
keys
()):
logger
.
debug
(
"
Activity path ->
"
+
str
(
key
)
+
"
-->
"
+
paths
[
key
])
logger
.
debug
(
"
Activity path ->
%s --> %s
"
,
key
,
paths
[
key
])
return
paths
...
...
@@ -142,8 +142,8 @@ class SpecificationHandler(ServiceMessageHandler):
self
.
momimportxml_bus
=
ToBus
(
exchange
=
MOMIMPORTXML_BUSNAME
,
broker
=
DEFAULT_BROKER
)
def
add_specification
(
self
,
user
,
lofar_xml
):
logger
.
info
(
"
got specification from user
"
+
str
(
user
)
)
logger
.
debug
(
"
LOFAR-XML:
"
+
lofar_xml
)
logger
.
info
(
"
got specification from user
%s
"
,
user
)
logger
.
debug
(
"
LOFAR-XML:
%s
"
,
lofar_xml
)
self
.
_validate_lofarspec
(
lofar_xml
)
logger
.
info
(
"
lofar xml validates!
"
)
...
...
@@ -159,7 +159,7 @@ class SpecificationHandler(ServiceMessageHandler):
logger
.
info
(
"
Fired and forgot to mom.importXML
"
)
def
get_specification
(
self
,
user
,
id
):
logger
.
info
(
"
getting spec of id
"
+
str
(
id
)
)
logger
.
info
(
"
getting spec of id
%s
"
,
id
)
with
self
.
momqueryrpc
:
response
=
self
.
momqueryrpc
.
get_trigger_spec
(
user
,
id
)
return
response
...
...
@@ -200,7 +200,7 @@ class SpecificationHandler(ServiceMessageHandler):
if
activity
.
find
(
action
)
is
not
None
:
jobtype
=
action
break
logger
.
warning
(
"
!!! %s not found...
"
%
(
action
,)
)
logger
.
warning
(
"
!!! %s not found...
"
,
action
)
if
jobtype
is
None
:
raise
Exception
(
"
Specified activity is not permitted:
"
+
str
(
key
)
+
"
->
"
+
str
(
permitted_activities
)
...
...
@@ -220,20 +220,20 @@ class SpecificationHandler(ServiceMessageHandler):
self
.
_authenticateAction
(
str
(
user
),
str
(
project
),
str
(
jobtype
),
str
(
status
.
text
))
def
_isActive
(
self
,
project
):
logger
.
debug
(
"
Checking if project is active:
"
+
project
)
logger
.
debug
(
"
Checking if project is active:
%s
"
,
project
)
with
self
.
momqueryrpc
:
response
=
self
.
momqueryrpc
.
isProjectActive
(
project
)
# todo mock this for testing
return
response
[
'
active
'
]
def
_folderExists
(
self
,
path
):
logger
.
debug
(
"
Checking if path exists ->
"
+
path
)
logger
.
debug
(
"
Checking if path exists ->
%s
"
,
path
)
with
self
.
momqueryrpc
:
response
=
self
.
momqueryrpc
.
folderExists
(
path
)
# todo mock this for testing
return
response
[
"
exists
"
]
def
_authenticateAction
(
self
,
user
,
project
,
jobtype
,
state
):
logger
.
debug
(
"
Authenticate action ->
"
+
user
+
'
,
'
+
project
+
'
,
'
+
jobtype
+
'
,
'
+
state
)
"
Authenticate action ->
%s, %s, %s, %s
"
,
user
,
project
,
jobtype
,
state
)
with
self
.
momqueryrpc
:
response
=
self
.
momqueryrpc
.
authorized_add_with_status
(
user
,
project
,
jobtype
,
state
)
# todo mock this for testing
...
...
@@ -243,13 +243,13 @@ class SpecificationHandler(ServiceMessageHandler):
with
self
.
validationrpc
:
response
=
self
.
validationrpc
.
validate_specification
(
lofar_xml
)
if
not
response
[
"
valid
"
]:
raise
Exception
(
"
Invalid specification:
"
+
response
[
"
error
"
])
raise
Exception
(
"
Invalid specification:
%s
"
,
response
[
"
error
"
])
def
_validate_momspec
(
self
,
mom_xml
):
with
self
.
validationrpc
:
response
=
self
.
validationrpc
.
validate_mom_specification
(
mom_xml
)
if
not
response
[
"
valid
"
]:
raise
Exception
(
"
Invalid MoM specification:
"
+
response
[
"
error
"
])
raise
Exception
(
"
Invalid MoM specification:
%s
"
,
response
[
"
error
"
])
def
_add_spec_to_mom
(
self
,
mom_xml
):
# Construct message payload using old-style (MessageBus) message format
...
...
@@ -266,7 +266,7 @@ class SpecificationHandler(ServiceMessageHandler):
with
self
.
momimportxml_bus
:
self
.
momimportxml_bus
.
send
(
emsg
)
logger
.
debug
(
"
Send specs to MOM:
"
+
mom_xml
)
logger
.
debug
(
"
Send specs to MOM:
%s
"
,
mom_xml
)
def
_lofarxml_to_momxml
(
self
,
lofarxml
):
logger
.
debug
(
"
Translating LOFAR spec to MoM spec
"
)
...
...
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