Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bluesky_blissdata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
fs-ec
bluesky_blissdata
Commits
eb8a1282
Commit
eb8a1282
authored
1 month ago
by
Devin Burke
Committed by
Udai Singh
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
Added support to specify the redis database index. Valid indices are integers from 0 to 15
parent
643e8743
No related branches found
Branches containing commit
No related tags found
1 merge request
!5
Added support to specify the redis database index. Valid indices are integers from 0 to 15
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/bluesky_blissdata/dispatcher.py
+12
-3
12 additions, 3 deletions
src/bluesky_blissdata/dispatcher.py
src/bluesky_blissdata/run.py
+15
-2
15 additions, 2 deletions
src/bluesky_blissdata/run.py
with
27 additions
and
5 deletions
src/bluesky_blissdata/dispatcher.py
+
12
−
3
View file @
eb8a1282
...
...
@@ -187,7 +187,7 @@ class BlissdataDispatcher:
motors
:
List
[
str
]
detectors
:
List
[
str
]
def
__init__
(
self
,
host
:
str
=
"
localhost
"
,
port
:
int
=
6379
):
def
__init__
(
self
,
host
:
str
=
"
localhost
"
,
port
:
int
=
6379
,
index
:
int
=
0
):
"""
Initializes the dispatcher with a connection to the Redis server.
...
...
@@ -197,6 +197,8 @@ class BlissdataDispatcher:
The hostname of the Redis server (default is
"
localhost
"
).
port : int, optional
The port number of the Redis server (default is 6379).
index : int, optional
The index of the Redis database to use (default is 0).
"""
# Initialize some instance variables
self
.
exception_handler
=
ExceptionHandler
(
"
Error in connecting to redis server
"
)
...
...
@@ -208,13 +210,20 @@ class BlissdataDispatcher:
_logger
.
info
(
"
Connecting to redis server
"
)
if
index
not
in
range
(
16
):
self
.
exception_handler
(
ValueError
(
"
Invalid Redis database index. Must be an integer between 0 and 15.
"
)
)
try
:
self
.
_data_store
=
DataStore
(
f
"
redis://
{
host
}
:
{
port
}
"
,
init_db
=
True
)
self
.
_data_store
=
DataStore
(
f
"
redis://
{
host
}
:
{
port
}
/
{
index
}
"
,
init_db
=
True
)
except
OSError
as
e
:
self
.
exception_handler
(
e
)
except
RuntimeError
:
try
:
self
.
_data_store
=
DataStore
(
f
"
redis://
{
host
}
:
{
port
}
"
)
self
.
_data_store
=
DataStore
(
f
"
redis://
{
host
}
:
{
port
}
/
{
index
}
"
)
except
RuntimeError
as
exc
:
self
.
exception_handler
(
exc
)
...
...
This diff is collapsed.
Click to expand it.
src/bluesky_blissdata/run.py
+
15
−
2
View file @
eb8a1282
...
...
@@ -96,6 +96,15 @@ def parse_args(args):
help
=
"
redis connection port
"
,
)
parser
.
add_argument
(
"
--redis-index
"
,
"
--redis_index
"
,
dest
=
"
redis_index
"
,
default
=
0
,
type
=
int
,
help
=
"
redis db index
"
,
)
parser
.
add_argument
(
"
--zmq-host
"
,
"
--zmq_host
"
,
...
...
@@ -161,12 +170,16 @@ def main() -> None:
setup_logging
(
args
.
loglevel
)
_logger
.
info
(
"
starting bluesky_blissdata
"
)
_logger
.
info
(
f
"
Connection to redis sever:
{
args
.
redis_host
}
:
{
args
.
redis_port
}
"
)
_logger
.
info
(
f
"
Connection to redis sever:
{
args
.
redis_host
}
:
{
args
.
redis_port
}
/
{
args
.
redis_index
}
"
)
_logger
.
info
(
f
"
Connection to zmq sever:
{
args
.
zmq_host
}
:
{
args
.
zmq_port
}
"
)
# Initialize RemoteDispatcher for Bluesky
d
=
RemoteDispatcher
((
args
.
zmq_host
,
args
.
zmq_port
))
post_document
=
BlissdataDispatcher
(
args
.
redis_host
,
args
.
redis_port
)
post_document
=
BlissdataDispatcher
(
args
.
redis_host
,
args
.
redis_port
,
args
.
redis_index
)
# Subscribe the BlissdataDispatcher to the RemoteDispatcher
d
.
subscribe
(
post_document
)
...
...
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