From ab4fe20a880ea1abe5022a33bfdf2d4a1fd2dc66 Mon Sep 17 00:00:00 2001 From: Naomi Jarvis Date: Mon, 13 Apr 2026 15:54:43 -0400 Subject: [PATCH 1/3] allow use of calibdate in hdds2ccdb get --- ccdb/hdds2ccdb.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ccdb/hdds2ccdb.py b/ccdb/hdds2ccdb.py index ba6fa19e..2bd8d593 100755 --- a/ccdb/hdds2ccdb.py +++ b/ccdb/hdds2ccdb.py @@ -6,7 +6,7 @@ # author: richard.t.jones at uconn.edu # version: may 17, 2018 # -# Usage: hddm2ccdb.py [-r ] [-v ] command +# Usage: hddm2ccdb.py [-r ] [-v ] [-d ]command # where command is one of # * ls # * get
@@ -14,6 +14,7 @@ # with # is a run number starting at 1 [1] # is a variation string [default] +# is a date string like "2024-04-12 09:30:00" #
is a GEOMETRY table name, eg BeamLine_HDDS.xml # is a log comment to go with the ccdb update, in quotes # @@ -21,10 +22,11 @@ import os import sys import ccdb +import datetime def usage(): str1 = """ - Usage: hddm2ccdb.py [-r ] [-v ] command + Usage: hddm2ccdb.py [-r ] [-v ] [-d datetime] command where command is one of * ls
* get
@@ -32,6 +34,7 @@ def usage(): with is a run number or range, like 10222 or 10222-10224 [1] is a variation string [default] + is a date string, eg "2024-04-12 09:30:00"
is a GEOMETRY table name, eg BeamLine_HDDS.xml is a log comment to go with the ccdb update, in quotes """ @@ -64,7 +67,7 @@ def do_get_table(tpath): table = provider.get_type_table(tpath) try: runs = run.split('-') - ass = provider.get_assignment(tpath, runs[0], var) + ass = provider.get_assignment(tpath, runs[0], var, date) except: print( "no entry found") return @@ -90,6 +93,8 @@ def do_set_table(tpath, comment): get_table = "" set_table = "" comment = "" +date = "" + i = 1 while i < len(sys.argv[1:]): if sys.argv[i][:2] == "-r": @@ -104,6 +109,12 @@ def do_set_table(tpath, comment): else: i += 1 var = sys.argv[i] + elif sys.argv[i][:2] == "-d": + if len(sys.argv[i]) > 2: + date = sys.argv[i][2:] + else: + i += 1 + date = sys.argv[i] elif sys.argv[i] == "ls": i += 1 ls_table = sys.argv[i] @@ -119,6 +130,10 @@ def do_set_table(tpath, comment): if not ls_table and not get_table and not set_table: usage() + +if date != "" : + calibdate = datetime.datetime.fromisoformat(date) + # Connect to CCDB DB sqlite_connect_str = os.environ["JANA_CALIB_URL"] provider = ccdb.AlchemyProvider() From d99a04367bda6ceea229b8520e61746574a4cd33 Mon Sep 17 00:00:00 2001 From: Naomi Jarvis Date: Mon, 13 Apr 2026 15:56:40 -0400 Subject: [PATCH 2/3] Revert "allow use of calibdate in hdds2ccdb get" This reverts commit ab4fe20a880ea1abe5022a33bfdf2d4a1fd2dc66. --- ccdb/hdds2ccdb.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/ccdb/hdds2ccdb.py b/ccdb/hdds2ccdb.py index 2bd8d593..ba6fa19e 100755 --- a/ccdb/hdds2ccdb.py +++ b/ccdb/hdds2ccdb.py @@ -6,7 +6,7 @@ # author: richard.t.jones at uconn.edu # version: may 17, 2018 # -# Usage: hddm2ccdb.py [-r ] [-v ] [-d ]command +# Usage: hddm2ccdb.py [-r ] [-v ] command # where command is one of # * ls
# * get
@@ -14,7 +14,6 @@ # with # is a run number starting at 1 [1] # is a variation string [default] -# is a date string like "2024-04-12 09:30:00" #
is a GEOMETRY table name, eg BeamLine_HDDS.xml # is a log comment to go with the ccdb update, in quotes # @@ -22,11 +21,10 @@ import os import sys import ccdb -import datetime def usage(): str1 = """ - Usage: hddm2ccdb.py [-r ] [-v ] [-d datetime] command + Usage: hddm2ccdb.py [-r ] [-v ] command where command is one of * ls
* get
@@ -34,7 +32,6 @@ def usage(): with is a run number or range, like 10222 or 10222-10224 [1] is a variation string [default] - is a date string, eg "2024-04-12 09:30:00"
is a GEOMETRY table name, eg BeamLine_HDDS.xml is a log comment to go with the ccdb update, in quotes """ @@ -67,7 +64,7 @@ def do_get_table(tpath): table = provider.get_type_table(tpath) try: runs = run.split('-') - ass = provider.get_assignment(tpath, runs[0], var, date) + ass = provider.get_assignment(tpath, runs[0], var) except: print( "no entry found") return @@ -93,8 +90,6 @@ def do_set_table(tpath, comment): get_table = "" set_table = "" comment = "" -date = "" - i = 1 while i < len(sys.argv[1:]): if sys.argv[i][:2] == "-r": @@ -109,12 +104,6 @@ def do_set_table(tpath, comment): else: i += 1 var = sys.argv[i] - elif sys.argv[i][:2] == "-d": - if len(sys.argv[i]) > 2: - date = sys.argv[i][2:] - else: - i += 1 - date = sys.argv[i] elif sys.argv[i] == "ls": i += 1 ls_table = sys.argv[i] @@ -130,10 +119,6 @@ def do_set_table(tpath, comment): if not ls_table and not get_table and not set_table: usage() - -if date != "" : - calibdate = datetime.datetime.fromisoformat(date) - # Connect to CCDB DB sqlite_connect_str = os.environ["JANA_CALIB_URL"] provider = ccdb.AlchemyProvider() From 4be61e26300c28be68ae602fc41e843364cf30b0 Mon Sep 17 00:00:00 2001 From: Naomi Jarvis Date: Mon, 13 Apr 2026 15:58:57 -0400 Subject: [PATCH 3/3] allow use of calibdate in get --- ccdb/hdds2ccdb.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ccdb/hdds2ccdb.py b/ccdb/hdds2ccdb.py index ba6fa19e..3bd4f978 100755 --- a/ccdb/hdds2ccdb.py +++ b/ccdb/hdds2ccdb.py @@ -6,7 +6,7 @@ # author: richard.t.jones at uconn.edu # version: may 17, 2018 # -# Usage: hddm2ccdb.py [-r ] [-v ] command +# Usage: hddm2ccdb.py [-r ] [-v ] [-d ] command # where command is one of # * ls
# * get
@@ -14,6 +14,7 @@ # with # is a run number starting at 1 [1] # is a variation string [default] +# is a date string like "2024-04-12 09:30:00" #
is a GEOMETRY table name, eg BeamLine_HDDS.xml # is a log comment to go with the ccdb update, in quotes # @@ -21,10 +22,11 @@ import os import sys import ccdb +import datetime def usage(): str1 = """ - Usage: hddm2ccdb.py [-r ] [-v ] command + Usage: hddm2ccdb.py [-r ] [-v ] [-d datetime] command where command is one of * ls
* get
@@ -32,6 +34,7 @@ def usage(): with is a run number or range, like 10222 or 10222-10224 [1] is a variation string [default] + is a date string, eg "2024-04-12 09:30:00"
is a GEOMETRY table name, eg BeamLine_HDDS.xml is a log comment to go with the ccdb update, in quotes """ @@ -64,7 +67,7 @@ def do_get_table(tpath): table = provider.get_type_table(tpath) try: runs = run.split('-') - ass = provider.get_assignment(tpath, runs[0], var) + ass = provider.get_assignment(tpath, runs[0], var, date) except: print( "no entry found") return @@ -90,6 +93,8 @@ def do_set_table(tpath, comment): get_table = "" set_table = "" comment = "" +date = "" + i = 1 while i < len(sys.argv[1:]): if sys.argv[i][:2] == "-r": @@ -104,6 +109,12 @@ def do_set_table(tpath, comment): else: i += 1 var = sys.argv[i] + elif sys.argv[i][:2] == "-d": + if len(sys.argv[i]) > 2: + date = sys.argv[i][2:] + else: + i += 1 + date = sys.argv[i] elif sys.argv[i] == "ls": i += 1 ls_table = sys.argv[i] @@ -119,6 +130,10 @@ def do_set_table(tpath, comment): if not ls_table and not get_table and not set_table: usage() + +if date != "" : + calibdate = datetime.datetime.fromisoformat(date) + # Connect to CCDB DB sqlite_connect_str = os.environ["JANA_CALIB_URL"] provider = ccdb.AlchemyProvider()