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
2d9d300e
Commit
2d9d300e
authored
Jan 13, 2025
by
BO ZHANG
🏀
Browse files
add utils
parent
7992adb4
Changes
3
Hide whitespace changes
Inline
Side-by-side
batch/msc-v093/trigger.py
View file @
2d9d300e
import
numpy
as
np
import
numpy
as
np
from
csst_dag
import
CSST_DAG_LIST
,
Redis
from
csst_dag
import
CSST_DAG_LIST
,
Redis
,
dump_message_list
from
csst_dag.constants
import
MSC_MBI_CHIPID
from
csst_dag.constants
import
MSC_MBI_CHIPID
# set BATCH_ID and DATASET
# set BATCH_ID and DATASET
...
@@ -28,6 +28,14 @@ for this_obsid in OBSID_LIST_CORRECTED:
...
@@ -28,6 +28,14 @@ for this_obsid in OBSID_LIST_CORRECTED:
)
)
message_list
.
append
(
this_message
)
message_list
.
append
(
this_message
)
# push messages to redis
# push messages to redis
for
msg
in
message_list
:
for
msg
in
message_list
:
r
.
push
(
msg
)
r
.
push
(
msg
)
print
(
f
" N_message =
{
len
(
message_list
)
}
"
)
print
(
f
" N_in_redis =
{
len
(
r
.
get_all
())
}
"
)
# dump messages
dump_message_list
(
message_list
,
path
=
f
"batch/msc-v093/C9_W1_Phot.
{
BATCH_ID
}
"
)
csst_dag/__init__.py
View file @
2d9d300e
# from .dag import gen_dag_run_id, gen_level1_dag_message, CSST_DAG_LIST
# from .dag import gen_dag_run_id, gen_level1_dag_message, CSST_DAG_LIST
from
.redis
import
Redis
from
.redis
import
Redis
from
.dag
import
CSST_DAG_LIST
# all DAGs
from
.dag
import
CSST_DAG_LIST
# all DAGs
from
.utils
import
dump_message_list
from
.constants
import
MSC_MBI_CHIPID
csst_dag/utils/__init__.py
0 → 100644
View file @
2d9d300e
import
json
def
dump_message_list
(
messages
,
path
=
""
,
):
with
open
(
path
+
".messages"
,
"w+"
)
as
f
:
for
msg
in
messages
:
f
.
write
(
msg
+
"
\n
"
)
with
open
(
path
+
".dag_run_id"
,
"w+"
)
as
f
:
for
msg
in
messages
:
f
.
write
(
json
.
loads
(
msg
)[
"dag_run_id"
]
+
"
\n
"
)
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