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
3b0a82fa
Commit
3b0a82fa
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-421
: removed _send_state_change_event_message because the TMSSPGListener does that for us now.
parent
c021622a
No related branches found
No related tags found
1 merge request
!262
Resolve TMSS-421
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/src/tmss/tmssapp/models/scheduling.py
+0
-20
0 additions, 20 deletions
SAS/TMSS/src/tmss/tmssapp/models/scheduling.py
with
0 additions
and
20 deletions
SAS/TMSS/src/tmss/tmssapp/models/scheduling.py
+
0
−
20
View file @
3b0a82fa
...
...
@@ -18,10 +18,6 @@ from django.db.models.expressions import RawSQL
from
django.core.exceptions
import
ValidationError
from
lofar.sas.tmss.tmss.exceptions
import
SubtaskSchedulingException
from
lofar.messaging.messagebus
import
ToBus
,
DEFAULT_BROKER
,
DEFAULT_BUSNAME
from
lofar.messaging.messages
import
EventMessage
from
lofar.sas.tmss.client.tmssbuslistener
import
DEFAULT_TMSS_SUBTASK_NOTIFICATION_PREFIX
from
lofar.common.util
import
single_line_with_single_spaces
from
django.conf
import
settings
from
lofar.sas.resourceassignment.resourceassignmentservice.rpc
import
RADBRPC
#
...
...
@@ -158,17 +154,6 @@ class Subtask(BasicCommon):
# keep original state for logging
self
.
__original_state_id
=
self
.
state_id
@staticmethod
def
_send_state_change_event_message
(
subtask_id
:
int
,
old_state
:
str
,
new_state
:
str
):
with
ToBus
(
exchange
=
os
.
environ
.
get
(
"
TMSS_EXCHANGE
"
,
DEFAULT_BUSNAME
),
broker
=
os
.
environ
.
get
(
"
TMSS_BROKER
"
,
DEFAULT_BROKER
))
as
tobus
:
#TODO: do we want to connect to the bus for each new message, or have some global tobus?
msg
=
EventMessage
(
subject
=
"
%s.%s
"
%
(
DEFAULT_TMSS_SUBTASK_NOTIFICATION_PREFIX
,
new_state
.
capitalize
()),
content
=
{
'
subtask_id
'
:
subtask_id
,
'
old_state
'
:
old_state
,
'
new_state
'
:
new_state
})
address
=
tobus
.
remote_address
logger
.
info
(
"
Sending message with subject
'
%s
'
to exchange=
'
%s
'
on broker=%s:%s content: %s
"
,
msg
.
subject
,
tobus
.
exchange
,
address
[
0
],
address
[
1
],
single_line_with_single_spaces
(
msg
.
content
))
tobus
.
send
(
msg
)
@property
def
successors
(
self
)
->
QuerySet
:
'''
return the connect successor subtask(s) as queryset (over which you can perform extended queries, or return via the serializers/viewsets)
...
...
@@ -229,11 +214,6 @@ class Subtask(BasicCommon):
user
=
self
.
created_or_updated_by_user
,
user_identifier
=
identifier
)
log_entry
.
save
()
try
:
self
.
_send_state_change_event_message
(
self
.
id
,
log_entry
.
old_state
.
value
,
log_entry
.
new_state
.
value
)
except
Exception
as
e
:
logger
.
error
(
"
Could not send state change to messagebus: %s
"
,
e
)
# update the previous state value
self
.
__original_state_id
=
self
.
state_id
...
...
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