Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-cicd
csst-dag
Commits
d7b79743
Commit
d7b79743
authored
Jun 13, 2025
by
BO ZHANG
🏀
Browse files
update dfs
parent
85880de1
Changes
2
Hide whitespace changes
Inline
Side-by-side
csst_dag/dfs/__init__.py
→
csst_dag/
_
dfs/__init__.py
View file @
d7b79743
...
...
@@ -3,6 +3,7 @@ import toml
import
os
from
astropy.table
import
Table
import
socket
from
csst_dfs_client
import
plan
,
level0
,
level1
,
level2
,
dag
,
catalog
CONFIG
=
toml
.
load
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"config.toml"
))
...
...
@@ -31,6 +32,14 @@ def check_port(ip, port, timeout=3):
class
DFS
:
plan
=
plan
level0
=
level0
level1
=
level1
level2
=
level2
dag
=
dag
catalog
=
catalog
def
__init__
(
self
,
location
=
None
):
# try each location
print
(
"Test all locations..."
,
end
=
""
)
...
...
@@ -78,40 +87,41 @@ class DFS:
# self.redis = Redis(location=self.location)
class
Redis
(
redis
.
Redis
):
def
__init__
(
self
,
location
=
"naoc"
,
**
kwargs
):
if
location
not
in
CONFIG
.
keys
():
print
(
"Available redis locations: "
,
list
(
CONFIG
.
keys
()))
raise
ValueError
(
f
"Unknown redis location:
{
location
}
"
)
super
().
__init__
(
host
=
CONFIG
[
location
][
"redis"
][
"host"
],
port
=
CONFIG
[
location
][
"redis"
][
"port"
],
db
=
CONFIG
[
location
][
"redis"
][
"db"
],
password
=
CONFIG
[
location
][
"redis"
][
"password"
],
**
kwargs
,
)
self
.
qname
=
password
=
CONFIG
[
location
][
"redis"
][
"qname"
]
self
.
config
=
CONFIG
[
location
][
"redis"
]
# print("Setting redis config:")
# for k, v in self.config.items():
# print(f" - {k}: {v}")
def
push
(
self
,
msg
):
self
.
lpush
(
self
.
qname
,
msg
)
def
pop
(
self
):
return
self
.
rpop
(
self
.
qname
)
dfs
=
DFS
(
location
=
None
)
def
get_all
(
self
):
return
self
.
lrange
(
self
.
qname
,
0
,
-
1
)
# class Redis(redis.Redis):
# def __init__(self, location="naoc", **kwargs):
# if location not in CONFIG.keys():
# print("Available redis locations: ", list(CONFIG.keys()))
# raise ValueError(f"Unknown redis location: {location}")
# super().__init__(
# host=CONFIG[location]["redis"]["host"],
# port=CONFIG[location]["redis"]["port"],
# db=CONFIG[location]["redis"]["db"],
# password=CONFIG[location]["redis"]["password"],
# **kwargs,
# )
# self.qname = password = CONFIG[location]["redis"]["qname"]
# self.config = CONFIG[location]["redis"]
# # print("Setting redis config:")
# # for k, v in self.config.items():
# # print(f" - {k}: {v}")
#
# def push(self, msg):
# self.lpush(self.qname, msg)
#
# def pop(self):
# return self.rpop(self.qname)
#
# def get_all(self):
# return self.lrange(self.qname, 0, -1)
dfs
=
DFS
(
location
=
None
)
# msgs = r.lrange(name, 0, -1)
# for chipid in range(6, 26):
# this_msg = gen_msg(
# dag="csst-msc-l1-mbi", obsid="11009101682009", chipid=f"{chipid:02d}"
# dag
_cfg
="csst-msc-l1-mbi", obsid="11009101682009", chipid=f"{chipid:02d}"
# )
# print(this_msg)
# r.lpush(name, this_msg)
...
...
csst_dag/dfs/config.toml
→
csst_dag/
_
dfs/config.toml
View file @
d7b79743
File moved
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment