Skip to content

Commit

Permalink
Optional parameters (oda-hub#704)
Browse files Browse the repository at this point in the history
* Parameters is_optional

* optional by default (backward compatibility)

* metadata

* represent None as '\x00' in request

* is_optioanl=False by default

* UserCatalog, InputProdList are optional

* fix dummy

* adapt

* adapt

* adapt ImageQuery for integral compatibility

* minor code style

* do not string-encode parameter list

* adapt test

* fix adapt test

* keep old method name

* tmp: integral plugin branch

* Revert "tmp: integral plugin branch"

This reverts commit cbc0fd8.

* pytest is test dependency

* test optional parameters

* Update cdci_data_analysis/analysis/parameters.py

Co-authored-by: Gabriele Barni <[email protected]>

---------

Co-authored-by: Gabriele Barni <[email protected]>
  • Loading branch information
dsavchenko and burnout87 authored Nov 22, 2024
1 parent d1d020b commit b8868e0
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 61 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ js9.fits
test-dispatcher-conf-with-gallery.yaml
tests/oda-ontology.ttl
tests/request_files
tests/local_request_files
tests/local_request_files
.lock_*
6 changes: 3 additions & 3 deletions cdci_data_analysis/analysis/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def run_query(self, product_type,
job.set_done()
if query_out.status_dictionary['status'] == 0:
query_out.set_done(message='dry-run',job_status=job.status)
query_out.set_instrument_parameters(self.get_parameters_list_as_json(prod_name=product_type))
query_out.set_instrument_parameters(self.get_parameters_list_jsonifiable(prod_name=product_type))
else:
if query_out.status_dictionary['status'] == 0:
query_out = QueryOutput()
Expand Down Expand Up @@ -593,7 +593,7 @@ def show_parameters_list(self):
_query.show_parameters_list()
print("-------------")

def get_parameters_list_as_json(self, add_src_query=True, add_instr_query=True, prod_name=None):
def get_parameters_list_jsonifiable(self, add_src_query=True, add_instr_query=True, prod_name=None):

l=[{'instrumet':self.name}]
l.append({'prod_dict':self.query_dictionary})
Expand All @@ -608,7 +608,7 @@ def get_parameters_list_as_json(self, add_src_query=True, add_instr_query=True,
if isinstance(_query, ProductQuery) and prod_name is not None and _query.name!=self.query_dictionary[prod_name]:
continue

l.append(_query.get_parameters_list_as_json(prod_dict=self.query_dictionary))
l.append(_query.get_parameters_list_jsonifiable(prod_dict=self.query_dictionary))

return l

Expand Down
Loading

0 comments on commit b8868e0

Please sign in to comment.