Skip to content
GitLab
Explore
Sign in
Register
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
299e8007
Commit
299e8007
authored
5 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
SW-772
: improved tmp exchange/queue names
parent
2d510fb4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!8
Cobalt2 multithreading fix
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
LCS/Messaging/python/messaging/messagebus.py
+5
-4
5 additions, 4 deletions
LCS/Messaging/python/messaging/messagebus.py
LCS/Messaging/python/messaging/rpc.py
+2
-1
2 additions, 1 deletion
LCS/Messaging/python/messaging/rpc.py
with
7 additions
and
5 deletions
LCS/Messaging/python/messaging/messagebus.py
+
5
−
4
View file @
299e8007
...
@@ -187,6 +187,7 @@ some.event bar
...
@@ -187,6 +187,7 @@ some.event bar
"""
"""
from
lofar.messaging.exceptions
import
*
from
lofar.messaging.exceptions
import
*
from
lofar.messaging
import
adaptNameToEnvironment
from
lofar.messaging.messages
import
*
from
lofar.messaging.messages
import
*
from
lofar.messaging.config
import
DEFAULT_BROKER
,
DEFAULT_BUSNAME
,
DEFAULT_PORT
,
DEFAULT_USER
,
DEFAULT_PASSWORD
from
lofar.messaging.config
import
DEFAULT_BROKER
,
DEFAULT_BUSNAME
,
DEFAULT_PORT
,
DEFAULT_USER
,
DEFAULT_PASSWORD
from
lofar.common.threading_utils
import
TimeoutLock
from
lofar.common.threading_utils
import
TimeoutLock
...
@@ -807,8 +808,8 @@ class TemporaryExchange:
...
@@ -807,8 +808,8 @@ class TemporaryExchange:
It is advised to use the TemporaryExchange instance in a
'
with
'
context, which guarantees the close call.
It is advised to use the TemporaryExchange instance in a
'
with
'
context, which guarantees the close call.
"""
"""
# create an identifiable address based on the given name which is also (almost) unique, and readable.
# create an identifiable address based on the given name which is also (almost) unique, and readable.
self
.
address
=
"
%stmp-exchange-%s
"
%
(
self
.
_name_prefix
+
"
-
"
if
self
.
_name_prefix
else
""
,
self
.
address
=
adaptNameToEnvironment
(
"
%stmp-exchange-%s
"
%
(
self
.
_name_prefix
+
"
-
"
if
self
.
_name_prefix
else
""
,
uuid
.
uuid4
().
hex
[:
8
])
uuid
.
uuid4
().
hex
[:
8
])
)
logger
.
debug
(
"
Creating TemporaryExchange at %s ...
"
,
self
.
address
)
logger
.
debug
(
"
Creating TemporaryExchange at %s ...
"
,
self
.
address
)
create_exchange
(
name
=
self
.
address
,
broker
=
self
.
broker
)
create_exchange
(
name
=
self
.
address
,
broker
=
self
.
broker
)
logger
.
debug
(
"
Created TemporaryExchange at %s
"
,
self
.
address
)
logger
.
debug
(
"
Created TemporaryExchange at %s
"
,
self
.
address
)
...
@@ -937,8 +938,8 @@ class TemporaryQueue:
...
@@ -937,8 +938,8 @@ class TemporaryQueue:
It is advised to use the TemporaryQueue instance in a
'
with
'
context, which guarantees the close call.
It is advised to use the TemporaryQueue instance in a
'
with
'
context, which guarantees the close call.
"""
"""
# create an identifiable address based on the given name which is also (almost) unique, and readable.
# create an identifiable address based on the given name which is also (almost) unique, and readable.
self
.
address
=
"
%stmp-queue-%s
"
%
(
self
.
_name_prefix
+
"
-
"
if
self
.
_name_prefix
else
""
,
self
.
address
=
adaptNameToEnvironment
(
"
%stmp-queue-%s
"
%
(
self
.
_name_prefix
+
"
-
"
if
self
.
_name_prefix
else
""
,
uuid
.
uuid4
().
hex
[:
8
])
uuid
.
uuid4
().
hex
[:
8
])
)
logger
.
debug
(
"
Creating TemporaryQueue at %s ...
"
,
self
.
address
)
logger
.
debug
(
"
Creating TemporaryQueue at %s ...
"
,
self
.
address
)
if
not
self
.
_bound_exchange
:
if
not
self
.
_bound_exchange
:
...
...
This diff is collapsed.
Click to expand it.
LCS/Messaging/python/messaging/rpc.py
+
2
−
1
View file @
299e8007
...
@@ -64,6 +64,7 @@ from lofar.messaging.config import DEFAULT_BROKER, DEFAULT_BUSNAME
...
@@ -64,6 +64,7 @@ from lofar.messaging.config import DEFAULT_BROKER, DEFAULT_BUSNAME
from
lofar.messaging.messagebus
import
ToBus
,
BusListener
,
AbstractMessageHandler
,
UsingToBusMixin
,
TemporaryQueue
from
lofar.messaging.messagebus
import
ToBus
,
BusListener
,
AbstractMessageHandler
,
UsingToBusMixin
,
TemporaryQueue
from
lofar.messaging.messages
import
LofarMessage
,
MessageFactory
from
lofar.messaging.messages
import
LofarMessage
,
MessageFactory
from
lofar.messaging.exceptions
import
MessagingError
from
lofar.messaging.exceptions
import
MessagingError
from
lofar.common.util
import
program_name
from
typing
import
Optional
from
typing
import
Optional
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
import
logging
import
logging
...
@@ -336,7 +337,7 @@ class RPCClient():
...
@@ -336,7 +337,7 @@ class RPCClient():
broker
=
self
.
_request_sender
.
broker
broker
=
self
.
_request_sender
.
broker
# setup a temporary queue on which we can receive the answer from the service
# setup a temporary queue on which we can receive the answer from the service
with
TemporaryQueue
(
name_prefix
=
"
rpc-reply-for-
"
+
self
.
_service_name
,
with
TemporaryQueue
(
name_prefix
=
"
rpc-reply-for-
%s-%s
"
%
(
program_name
(
include_extension
=
False
),
self
.
_service_name
)
,
exchange
=
exchange
,
exchange
=
exchange
,
broker
=
broker
,
broker
=
broker
,
addressed_to_me_only
=
True
)
as
tmp_reply_queue
:
addressed_to_me_only
=
True
)
as
tmp_reply_queue
:
...
...
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