From 62b3387d05a88b3d1cb690b18ff3a2c2613cf91f Mon Sep 17 00:00:00 2001 From: Maurice Manning Date: Tue, 11 Dec 2012 10:27:12 -0800 Subject: [PATCH 1/3] ion_loader with changes, fails preload --- ion/processes/bootstrap/ion_loader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ion/processes/bootstrap/ion_loader.py b/ion/processes/bootstrap/ion_loader.py index 122b22d53..e111708e7 100755 --- a/ion/processes/bootstrap/ion_loader.py +++ b/ion/processes/bootstrap/ion_loader.py @@ -1267,7 +1267,7 @@ def _load_ParameterDictionary(self, row): try: context_ids = [dataset_management.read_parameter_context_by_name(i)._id for i in contexts] temporal_parameter = row['temporal_parameter'] or '' - dataset_management.create_parameter_dictionary(name=row['name'], + dataset_management.create_parameter_dictionary(name=row['name'], parameter_context_ids=context_ids, temporal_context=temporal_parameter, headers=self._get_system_actor_headers()) @@ -1733,6 +1733,9 @@ def _load_DataProduct(self, row, do_bulk=False): else: svc_client = self._get_service_client("data_product_management") stream_definition_id = self.resource_ids[row["stream_def_id"]] + log.debug("create_data_product res_obj %s ", res_obj) + log.debug("create_data_product stream_definition_id %s ", stream_definition_id) + log.debug("create_data_product parameter dictionary id %s ", self.resource_objs[stream_definition_id].parameter_dictionary_id) res_id = svc_client.create_data_product(data_product=res_obj, stream_definition_id=stream_definition_id, headers=headers) self._register_id(row[self.COL_ID], res_id, res_obj) From ec632e0af082a59a87fb8bad3376b76503a99d9e Mon Sep 17 00:00:00 2001 From: Jonathan Newbrough Date: Tue, 11 Dec 2012 12:24:39 -0800 Subject: [PATCH 2/3] fixed preload issue (broken pubsub association call) --- ion/processes/bootstrap/ion_loader.py | 7 +------ ion/services/dm/distribution/pubsub_management_service.py | 6 ++++-- ion/services/sa/product/data_product_management_service.py | 2 -- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/ion/processes/bootstrap/ion_loader.py b/ion/processes/bootstrap/ion_loader.py index e111708e7..a1c262aa5 100755 --- a/ion/processes/bootstrap/ion_loader.py +++ b/ion/processes/bootstrap/ion_loader.py @@ -1198,8 +1198,6 @@ def _load_InstrumentSite_OOI(self): def _load_StreamDefinition(self, row): res_obj = self._create_object_from_row("StreamDefinition", row, "sdef/") -# sd_module = row["StreamContainer_module"] -# sd_method = row["StreamContainer_method"] pname = row["param_dict_name"] svc_client = self._get_service_client("dataset_management") parameter_dictionary_id = svc_client.read_parameter_dictionary_by_name(pname, id_only=True, @@ -1208,7 +1206,7 @@ def _load_StreamDefinition(self, row): res_id = svc_client.create_stream_definition(name=res_obj.name, parameter_dictionary_id=parameter_dictionary_id, headers=self._get_system_actor_headers()) self._register_id(row[self.COL_ID], res_id) - + def _load_ParameterDefs(self, row): param_type = row['Parameter Type'] if param_type == 'record': @@ -1733,9 +1731,6 @@ def _load_DataProduct(self, row, do_bulk=False): else: svc_client = self._get_service_client("data_product_management") stream_definition_id = self.resource_ids[row["stream_def_id"]] - log.debug("create_data_product res_obj %s ", res_obj) - log.debug("create_data_product stream_definition_id %s ", stream_definition_id) - log.debug("create_data_product parameter dictionary id %s ", self.resource_objs[stream_definition_id].parameter_dictionary_id) res_id = svc_client.create_data_product(data_product=res_obj, stream_definition_id=stream_definition_id, headers=headers) self._register_id(row[self.COL_ID], res_id, res_obj) diff --git a/ion/services/dm/distribution/pubsub_management_service.py b/ion/services/dm/distribution/pubsub_management_service.py index 5ad37f5ed..c54dfceb5 100644 --- a/ion/services/dm/distribution/pubsub_management_service.py +++ b/ion/services/dm/distribution/pubsub_management_service.py @@ -42,7 +42,9 @@ def create_stream_definition(self, name='', parameter_dictionary=None, parameter return existing[0] raise Conflict('StreamDefinition with the specified name already exists. (%s)' % name) - if not name: create_unique_identifier() + if not name: + create_unique_identifier() +# name = create_unique_identifier() stream_definition = StreamDefinition(parameter_dictionary=parameter_dictionary, stream_type=stream_type, name=name, description=description) stream_definition_id,_ = self.clients.resource_registry.create(stream_definition) @@ -60,7 +62,7 @@ def read_stream_definition(self, stream_definition_id='', stream_id=''): else: raise NotFound('No Stream Definition is associated with this Stream') stream_definition = retval or self.clients.resource_registry.read(stream_definition_id) - pdicts, _ = self.clients.resource_registry.find_objects(subject=stream_definition._id, object_type=RT.ParameterDictionaryResource, id_only=True) + pdicts, _ = self.clients.resource_registry.find_objects(subject=stream_definition._id, predicate=PRED.hasParameterDictionary, object_type=RT.ParameterDictionaryResource, id_only=True) if len(pdicts): stream_definition.parameter_dictionary = DatasetManagementService.get_parameter_dictionary(pdicts[0]).dump() validate_is_instance(stream_definition,StreamDefinition) diff --git a/ion/services/sa/product/data_product_management_service.py b/ion/services/sa/product/data_product_management_service.py index 790989c6a..41923a869 100644 --- a/ion/services/sa/product/data_product_management_service.py +++ b/ion/services/sa/product/data_product_management_service.py @@ -44,8 +44,6 @@ def create_data_product(self, data_product=None, stream_definition_id='', parame res, _ = self.clients.resource_registry.find_resources(restype=RT.DataProduct, name=data_product.name, id_only=True) validate_false(len(res), 'A data product with the name %s already exists.' % data_product.name) log.info('Creating DataProduct: %s', data_product.name) - log.debug('%s', data_product.__dict__) - # Create will validate and register a new data product within the system # If the stream definition has a parameter dictionary, use that From 507b9baa6d5b7720a796d1bc2e5f65951b815e9c Mon Sep 17 00:00:00 2001 From: Jonathan Newbrough Date: Tue, 11 Dec 2012 12:30:03 -0800 Subject: [PATCH 3/3] bumped ion-defs for maurice preload changes --- extern/ion-definitions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/ion-definitions b/extern/ion-definitions index 008b7518c..323b65f75 160000 --- a/extern/ion-definitions +++ b/extern/ion-definitions @@ -1 +1 @@ -Subproject commit 008b7518c687861e0f215c29985450038d53634d +Subproject commit 323b65f75f246976a43632eb65f7b03fa1411632