def delete_exchange_point(self, exchange_point_id=''): """Delete an existing exchange point resource. @param exchange_point_id str @throws NotFound object with specified id does not exist """ exchange_point = self.clients.resource_registry.read(exchange_point_id) if not exchange_point: raise NotFound("Exchange Point %s does not exist" % exchange_point_id) # get associated XS first exchange_space_list, assoc_list = self.clients.resource_registry.find_subjects( RT.ExchangeSpace, PRED.hasExchangePoint, exchange_point_id) if not len(exchange_space_list) == 1: raise NotFound( "Associated Exchange Space to Exchange Point %s does not exist" % exchange_point_id) exchange_space = exchange_space_list[0] # delete association to XS for assoc in assoc_list: self.clients.resource_registry.delete_association(assoc._id) # delete from RR self.clients.resource_registry.delete(exchange_point_id) # call container API xs = exchange.ExchangeSpace(self.container.ex_manager, exchange_space.name) xp = exchange.ExchangePoint(self.container.ex_manager, exchange_point.name, xs, 'ttree') self.container.ex_manager.delete_xp(xp, use_ems=False)
def register_process_operation_precondition(self, process, operation, precondition): """ This method is used to register process operation precondition functions with the governance controller. The endpoint code will call check_process_operation_preconditions() below before calling the business logic operation and if any of the precondition functions return False, then the request is denied as Unauthorized. At some point, this should be refactored to by another interceptor, but at the operation level. """ if not hasattr(process, operation): raise NotFound( "The operation %s does not exist for the %s process" % (operation, process.name)) if type(precondition ) == types.MethodType and precondition.im_self != process: raise NotFound("The method %s does not exist for the %s process." % (str(precondition), process.name)) process_op_conditions = self.get_process_operation_dict(process.name) if operation in process_op_conditions: process_op_conditions[operation].append(precondition) else: preconditions = list() preconditions.append(precondition) process_op_conditions[operation] = preconditions
def add_resource_policy(self, resource_id='', policy_id=''): """Associates a policy rule to a specific resource @param resource_id str @param policy_id str @retval success bool @throws NotFound object with specified id does not exist """ if not resource_id: raise BadRequest("The resource_id parameter is missing") resource = self.clients.resource_registry.read(resource_id) if not resource: raise NotFound("Resource %s does not exist" % resource_id) if not policy_id: raise BadRequest("The policy_id parameter is missing") policy = self.clients.resource_registry.read(policy_id) if not policy: raise NotFound("Policy %s does not exist" % policy_id) aid = self.clients.resource_registry.create_association( resource, PRED.hasPolicy, policy) if not aid: return False #Publish an event that the resource policy has changed self._publish_resource_policy_event(policy, resource) return True
def remove_resource_policy(self, resource_id='', policy_id=''): """Removes an association for a policy rule to a specific resource @param resource_id str @param policy_id str @retval success bool @throws NotFound object with specified id does not exist """ if not resource_id: raise BadRequest("The resource_id parameter is missing") resource = self.clients.resource_registry.read(resource_id) if not resource: raise NotFound("Resource %s does not exist" % resource_id) if not policy_id: raise BadRequest("The policy_id parameter is missing") policy = self.clients.resource_registry.read(policy_id) if not policy: raise NotFound("Policy %s does not exist" % policy_id) aid = self.clients.resource_registry.get_association( resource, PRED.hasPolicy, policy) if not aid: raise NotFound( "The association between the specified Resource %s and Policy %s was not found" % (resource_id, policy_id)) self.clients.resource_registry.delete_association(aid) #Publish an event that the resource policy has changed self._publish_resource_policy_event(policy, resource) return True
def register_process_operation_precondition(self, process, operation, precondition): if not hasattr(process, operation): raise NotFound( "The operation %s does not exist for the %s service" % (operation, process.name)) if type(precondition ) == types.MethodType and precondition.im_self != process: raise NotFound("The method %s does not exist for the %s service." % (str(precondition), process.name)) elif type(precondition) == types.StringType: #Convert string to instancemethod if it exists..if not store as potential precondition to execute method = getattr(process, precondition, None) if method: precondition = method process_op_conditions = self.get_process_operation_dict(process.name) if process_op_conditions.has_key(operation): process_op_conditions[operation].append(precondition) else: preconditions = list() preconditions.append(precondition) process_op_conditions[operation] = preconditions
def delete_user_info(self, user_info_id='', actor_identity_id=''): # Read UserInfo user_info = self.clients.resource_registry.read(user_info_id) if not user_info: raise NotFound("UserInfo %s does not exist" % user_info_id) # Find and break association with ActorIdentity if not actor_identity_id: subjects, assocs = self.clients.resource_registry.find_subjects( RT.ActorIdentity, PRED.hasInfo, user_info_id) if not assocs: raise NotFound( "ActorIdentity to UserInfo association for user info id %s does not exist" % user_info_id) actor_identity_id = subjects[0]._id assocs = self.clients.resource_registry.find_associations( actor_identity_id, PRED.hasInfo, user_info_id) if not assocs: raise NotFound( "ActorIdentity to UserInfo association for user info id %s does not exist" % user_info_id) association_id = assocs[0]._id self.clients.resource_registry.delete_association(association_id) # Delete the UserInfo self.clients.resource_registry.delete(user_info_id)
def acquire_data(hdf_files=None, var_names=None, concatenate_size=None, bounds=None): import h5py, numpy if hdf_files is None: raise NotFound('No open_hdf_files provided to extract data from.') if var_names is None: raise NotFound('Variable names where not provided.') if concatenate_size is None: raise NotFound('The concatenation size was not provided') open_files = [] try: for hdf_file in hdf_files: #------------------------------------------------------------------------------------------------------- # make a file object #------------------------------------------------------------------------------------------------------- try: file = h5py.File(hdf_file, 'r') except IOError as ioe: log.exception('Unable to open file: "%s"', hdf_file) # Try again? try: file = h5py.File(hdf_file, 'r') except: log.exception('Still Unable to open file: "%s" !', hdf_file) # If we are only opening one file - we must fail - but otherwise for now, just let it go! if len(hdf_files) == 1: raise ioe open_files.append(file) gen = _acquire_hdf_data(open_hdf_files=open_files, var_names=var_names, concatenate_size=concatenate_size, bounds=bounds) # run the generator yielding to the caller for item in gen: yield item finally: # always clean up! for file in open_files: file.close()
def undeclare_exchange_name(self, canonical_name='', exchange_space_id=''): """Remove an exhange nane resource @param canonical_name str @param exchange_space_id str @retval success bool @throws NotFound object with specified id does not exist """ # @TODO: currently we are using the exchange_name's id as the canonical name # and exchange_space_id is unused? exchange_name = self.container.resource_registry.read(canonical_name) if not exchange_name: raise NotFound("Exchange Name with id %s does not exist" % canonical_name) exchange_name_id = exchange_name._id # yes, this should be same, but let's make it look cleaner # get associated XS first exchange_space_list, assoc_list = self.container.resource_registry.find_subjects( RT.ExchangeSpace, PRED.hasExchangeName, exchange_name_id) if not len(exchange_space_list) == 1: raise NotFound( "Associated Exchange Space to Exchange Name %s does not exist" % exchange_name_id) exchange_space = exchange_space_list[0] # remove association between itself and XS _, assocs = self.container.resource_registry.find_subjects( RT.ExchangeSpace, PRED.hasExchangeName, exchange_name_id, id_only=True) for assoc in assocs: self.container.resource_registry.delete_association(assoc._id) # remove XN self.container.resource_registry.delete(exchange_name_id) # call container API xs = exchange.ExchangeSpace( self.container.ex_manager, self.container.ex_manager._priviledged_transport, exchange_space.name) xn = exchange.ExchangeName( self.container.ex_manager, self.container.ex_manager._priviledged_transport, exchange_name.name, xs) # type doesn't matter here self.container.ex_manager.delete_xn(xn, use_ems=False)
def read_doc(self, doc_id, rev_id="", datastore_name=""): ds, datastore_name = self._get_datastore(datastore_name) if not rev_id: log.debug('Reading head version of object %s/%s', datastore_name, doc_id) doc = ds.get(doc_id) if doc is None: raise NotFound('Object with id %s does not exist.' % str(doc_id)) else: log.debug('Reading version %s of object %s/%s' ,rev_id, datastore_name, doc_id) doc = ds.get(doc_id, rev=rev_id) if doc is None: raise NotFound('Object with id %s does not exist.' % str(doc_id)) log.debug('read doc contents: %s', doc) self._count(read=1) return doc
def find_user_info_by_id(self, actor_id=''): # Look up UserInfo via association with ActorIdentity objects, assocs = self.clients.resource_registry.find_objects(actor_id, PRED.hasInfo, RT.UserInfo) if not objects: raise NotFound("UserInfo for user id %s does not exist" % actor_id) user_info = objects[0] return user_info
def activate_subscription(self, subscription_id=''): ''' Bind a subscription using a channel layer. @param subscription_id The id of the subscription. @retval success Boolean to indicate successful activation. @throws NotFound when subscription doesn't exist. ''' log.debug("Activating subscription") subscription_obj = self.clients.resource_registry.read(subscription_id) if subscription_obj is None: raise NotFound("Subscription %s does not exist" % subscription_id) if subscription_obj.is_active: raise BadRequest('Subscription is already active!') ids, _ = self.clients.resource_registry.find_objects(subscription_id, PRED.hasStream, RT.Stream, id_only=True) if subscription_obj.subscription_type == SubscriptionTypeEnum.STREAM_QUERY: for stream_id in ids: self._bind_subscription(self.XP, subscription_obj.exchange_name, stream_id + '.data') elif subscription_obj.subscription_type == SubscriptionTypeEnum.EXCHANGE_QUERY: self._bind_subscription(self.XP, subscription_obj.exchange_name, '*.data') subscription_obj.is_active = True self.clients.resource_registry.update(object=subscription_obj) return True
def get_active_resource_policy_rules(self, resource_id=''): """Generates the set of all enabled policies for the specified resource @param resource_id str @retval policy str @throws NotFound object with specified id does not exist """ if not resource_id: raise BadRequest("The resource_id parameter is missing") resource = self.clients.resource_registry.read(resource_id) if not resource: raise NotFound("Resource %s does not exist" % resource_id) policy = self._get_policy_template() #TODO - investigate better ways to optimize this rules = "" policy_set = self.find_resource_policies(resource_id) for p in policy_set: if p.enabled: rules += p.rule policy_rules = policy % ('', resource_id, rules) return policy_rules
def read_doc(self, doc_id, rev_id=None, datastore_name=None): """" Fetch a raw doc instance. If rev_id is specified, an attempt will be made to return that specific doc version. Otherwise, the HEAD version is returned. """ ds, datastore_name = self._get_datastore(datastore_name) if not rev_id: doc = ds.get(doc_id) if doc is None: raise NotFound('Object with id %s does not exist.' % doc_id) else: doc = ds.get(doc_id, rev=rev_id) if doc is None: raise NotFound('Object with id %s does not exist.' % doc_id) return doc
def delete_persistence_instance(self, persistence_instance_id=''): """delete a PersistenceInstance resource from the resource registry remove any associations with the PersistenceInstance (Datastores or PersistenceSystems) @param persistence_instance_id str @throws NotFound resource with specified id does not exist """ persistence_instance = self.clients.resource_registry.read( persistence_instance_id) if persistence_instance is None: raise NotFound("PersistenceInstance %s does not exist" % persistence_instance_id) assocs = self.clients.resource_registry.find_associations( subject=persistence_instance_id, assoc_type=PRED.hasDatastore) for assoc in assocs: self.clients.resource_registry.delete_association( assoc._id) # Find and break association with Datastore assocs = self.clients.resource_registry.find_associations( predicate=persistence_instance_id, assoc_type=PRED.hasPersistenceInstance) for assoc in assocs: self.clients.resource_registry.delete_association( assoc._id) # Find and break association with PersistenceSystem self.clients.resource_registry.delete(persistence_instance_id)
def cancel_member_enrollment(self, org_id='', user_id=''): """Cancels the membership of a specified user within the specified Org. Once canceled, the user will no longer have access to the resource of that Org. Throws a NotFound exception if neither id is found. @param org_id str @param user_id str @retval success bool @throws NotFound object with specified id does not exist """ param_objects = self._validate_parameters(org_id=org_id, user_id=user_id) org = param_objects['org'] user = param_objects['user'] if org.name == ROOT_ION_ORG_NAME: raise BadRequest( "A request to cancel enrollment in the root ION Org is not allowed" ) #First remove all associations to any roles role_list = self.find_roles_by_user(org_id, user_id) for user_role in role_list: self._delete_role_association(org, user, user_role) #Finally remove the association to the Org aid = self.clients.resource_registry.get_association( org, PRED.hasMembership, user) if not aid: raise NotFound( "The membership association between the specified user and Org is not found" ) self.clients.resource_registry.delete_association(aid) return True
def unregister_process_operation_precondition(self, process, operation, precondition): #Just skip this if there operation is not passed in. if operation is None: return if not hasattr(process, operation): raise NotFound( "The operation %s does not exist for the %s service" % (operation, process.name)) if type(precondition) == types.StringType: #Convert string to instancemethod method = getattr(process, precondition, None) if method: precondition = method process_op_conditions = self.get_process_operation_dict(process.name) if process_op_conditions.has_key(operation): preconditions = process_op_conditions[operation] preconditions[:] = [ pre for pre in preconditions if not pre == precondition ] if not preconditions: del process_op_conditions[operation]
def unregister_process_operation_precondition(self, process, operation, precondition): """ This method removes a specific precondition function registered with an operation on a process. Care should be taken with this call, as it can remove "hard wired" preconditions that are directly registered by processes in a container. """ #Just skip this if there operation is not passed in. if operation is None: return if not hasattr(process, operation): raise NotFound( "The operation %s does not exist for the %s service" % (operation, process.name)) process_op_conditions = self.get_process_operation_dict(process.name, auto_add=False) if process_op_conditions is not None and operation in process_op_conditions: preconditions = process_op_conditions[operation] preconditions[:] = [ pre for pre in preconditions if not pre == precondition ] if not preconditions: del process_op_conditions[operation]
def create_exchange_space(self, exchange_space=None, org_id=''): """Creates an Exchange Space distributed resource from the parameter exchange_space object. @param exchange_space ExchangeSpace @param org_id str @retval exchange_space_id str @throws BadRequest if object passed has _id or _rev attribute """ log.debug("create_exchange_space(%s, org_id=%s)" % (exchange_space, org_id)) self.assert_condition(exchange_space and org_id, "Arguments not set") #First make sure that Org with the org_id exists, otherwise bail org = self.clients.resource_registry.read(org_id) if not org: raise NotFound("Org %s does not exist" % org_id) exchange_space_id, rev = self.clients.resource_registry.create( exchange_space) aid = self.clients.resource_registry.create_association( org_id, PRED.hasExchangeSpace, exchange_space_id) # Now do the work # if exchange_space.name == "ioncore": # # Bottom turtle initialization # # @TODO: what's different here # self.container.ex_manager.create_xs(exchange_space.name) # else: self.container.ex_manager.create_xs(exchange_space.name, use_ems=False) return exchange_space_id
def read_subject(self, subject_type="", predicate="", object="", assoc="", id_only=False): if assoc: if type(assoc) is str: assoc = self.read(assoc) return assoc.s if id_only else self.read(assoc.s) else: sub_list, assoc_list = self.find_subjects( subject_type=subject_type, predicate=predicate, object=object, id_only=True) if not sub_list: raise NotFound( "No subject found for subject_type=%s, predicate=%s, object=%s" % (subject_type, predicate, object)) elif len(sub_list) > 1: raise Inconsistent( "More than one subject found for subject_type=%s, predicate=%s, object=%s: count=%s" % (subject_type, predicate, object, len(sub_list))) return sub_list[0] if id_only else self.read(sub_list[0])
def find_user_info_by_name(self, name=''): objects, matches = self.clients.resource_registry.find_resources(RT.UserInfo, None, name, id_only=False) if not objects: raise NotFound("UserInfo with name %s does not exist" % name) if len(objects) > 1: raise Inconsistent("Multiple UserInfo objects with name %s exist" % name) return objects[0]
def buy_bonds(self, account_id='', cash_amount=0.0): """ Purchase the specified amount of bonds. Check is first made that the cash account has sufficient funds. """ account_obj = self.clients.resource_registry.read(account_id) if not account_obj: raise NotFound("Account %s does not exist" % account_id) if account_obj.cash_balance < cash_amount: raise BadRequest("Insufficient funds") owner_obj = self.clients.resource_registry.find_subjects( "BankCustomer", PRED.hasAccount, account_obj, False)[0][0] # Create order object and call trade service order_obj = IonObject("Order", type="buy", on_behalf=owner_obj.name, cash_amount=cash_amount) # Make the call to trade service confirmation_obj = self.clients.trade.exercise(order_obj) if confirmation_obj.status == "complete": account_obj.cash_balance -= cash_amount account_obj.bond_balance += confirmation_obj.proceeds self.clients.resource_registry.update(account_obj) return "Balances after bond purchase: cash %f, bonds: %s" % ( account_obj.cash_balance, account_obj.bond_balance) return "Bond purchase status is: %s" % confirmation_obj.status
def get_user_info_extension(self, user_info_id='', user_id=''): """Returns an UserInfoExtension object containing additional related information @param user_info_id str @retval user_info UserInfoExtension @throws BadRequest A parameter is missing @throws NotFound An object with the specified actor_id does not exist """ if not user_info_id: raise BadRequest("The user_info_id parameter is empty") extended_resource_handler = ExtendedResourceContainer(self) extended_user = extended_resource_handler.create_extended_resource_container( extended_resource_type=OT.UserInfoExtension, resource_id=user_info_id, user_id=user_id) #If the org_id is not provided then skip looking for Org related roles. if extended_user: #Did not setup a dependency to org_management service to avoid a potential circular bootstrap issue # since this method should never be called until the system is fully running try: org_client = OrgManagementServiceProcessClient(process=self) roles = org_client.find_all_roles_by_user(extended_user.actor_identity._id) extended_user.roles = list() for org_name in roles: for role in roles[org_name]: flattened_role = copy.copy(role.__dict__) del flattened_role['type_'] #Have to do this to appease the message validators for ION objects flattened_role['org_name'] = org_name #Nothing like forcing a value into the dict to appease the UI code extended_user.roles.append(flattened_role) except Exception, e: raise NotFound('Could not retrieve UserRoles for User Info id: %s - %s' % (user_info_id, e.message))
def delete_doc(self, doc, datastore_name="", del_associations=False): ds, datastore_name = self._get_datastore(datastore_name) doc_id = doc if type(doc) is str else doc["_id"] log.debug('Deleting object %s/%s', datastore_name, doc_id) if del_associations: assoc_ids = self.find_associations(anyobj=doc_id, id_only=True) self.delete_doc_mult(assoc_ids) # for aid in assoc_ids: # self.delete(aid, datastore_name=datastore_name) # log.info("Deleted %n associations for object %s", len(assoc_ids), doc_id) elif self._is_in_association(doc_id, datastore_name): bad_doc = self.read(doc_id) if doc: log.warn("XXXXXXX Attempt to delete %s object %s that still has associations" % (bad_doc.type_, doc_id)) else: log.warn("XXXXXXX Attempt to delete object %s that still has associations" % doc_id) # raise BadRequest("Object cannot be deleted until associations are broken") try: if type(doc) is str: del ds[doc_id] else: ds.delete(doc) self._count(delete=1) except ResourceNotFound: raise NotFound('Object with id %s does not exist.' % doc_id)
def unregister_user_credentials(self, actor_id='', credentials_name=''): # Read UserCredentials objects, matches = self.clients.resource_registry.find_resources(RT.UserCredentials, None, credentials_name, id_only=False) if not objects or len(objects) == 0: raise NotFound("UserCredentials %s does not exist" % credentials_name) if len(objects) > 1: raise Conflict("Multiple UserCredentials objects found for subject %s" % credentials_name) user_credentials_id = objects[0]._id # Find and break association with ActorIdentity assocs = self.clients.resource_registry.find_associations(actor_id, PRED.hasCredentials, user_credentials_id) if not assocs or len(assocs) == 0: raise NotFound("ActorIdentity to UserCredentials association for user id %s to credential %s does not exist" % (actor_id, credentials_name)) association_id = assocs[0]._id self.clients.resource_registry.delete_association(association_id) # Delete the UserCredentials self.clients.resource_registry.delete(user_credentials_id)
def delete_datastore(self, datastore_id=''): """delete a datastore resource from the resource registry remove any associations with the datastore (PersistenceSystems or PersistenceInstances) @param datastore_id str @throws NotFound object with specified id does not exist """ datastore = self.clients.resource_registry.read(datastore_id) if datastore is None: raise NotFound("Datastore %s does not exist" % datastore_id) assocs = self.clients.resource_registry.find_associations( object=datastore_id, assoc_type=PRED.hasDatastore) for assoc in assocs: self.clients.resource_registry.delete_association( assoc._id) # Find and break association with PersistenceSystem assocs = self.clients.resource_registry.find_associations( subject=datastore_id, assoc_type=PRED.hasArchive) for assoc in assocs: self.clients.resource_registry.delete_association( assoc._id ) # Find and break association with PersistentArchvies self.clients.resource_registry.delete(datastore_id)
def _get_base_parameter(self, data_product_id, parameter_name): # Get the parameter parameters = self.data_product_management.get_data_product_parameters( data_product_id) parameter_obj = None for parameter in parameters: if parameter.name == parameter_name: parameter_obj = parameter break if parameter_obj is None: # Still None raise NotFound("Data product %s doesn't have a parameter %s" % (data_product_id, parameter_name)) # Get the DPS Code dps_code = parameter.ooi_short_name if not dps_code: raise BadRequest( "Parameter %s (%s) has no defined data product code" % (parameter.name, parameter._id)) # Make the dps_code + _l1b_pd if re.match(r'.*_L[0-2]', dps_code): print "matches" dps_code = dps_code[:-3] return dps_code, parameter
def delete_doc(self, doc, datastore_name=""): if not datastore_name: datastore_name = self.datastore_name try: datastore_dict = self.root[datastore_name] except KeyError: raise BadRequest('Data store ' + datastore_name + ' does not exist.') if type(doc) is str: object_id = doc else: object_id = doc["_id"] log.info('Deleting object %s/%s' % (datastore_name, object_id)) if object_id in datastore_dict.keys(): if self._is_in_association(object_id, datastore_name): obj = self.read(object_id, "", datastore_name) log.warn( "XXXXXXX Attempt to delete object %s that still has associations" % str(obj)) # raise BadRequest("Object cannot be deleted until associations are broken") # Find all version dicts and delete them for key in datastore_dict.keys(): if key.find(object_id + '_version_') == 0: del datastore_dict[key] # Delete the HEAD dict del datastore_dict[object_id] # Delete the version counter dict del datastore_dict['__' + object_id + '_version_counter'] else: raise NotFound('Object with id ' + object_id + ' does not exist.') log.info('Delete result: True')
def read_data_process(self, data_process_id=""): # Read DataProcess object with _id matching id log.debug("Reading DataProcess object id: %s" % data_process_id) data_proc_obj = self.clients.resource_registry.read(data_process_id) if not data_proc_obj: raise NotFound("DataProcess %s does not exist" % data_process_id) return data_proc_obj
def test_assign_single_subject(self): x = "x_id" y = "y_id" def rst(): self.rr.find_subjects.reset_mock() self.rr.get_association.reset_mock() rst() self.rr.find_subjects.return_value = ([], []) self.RR2.assign_instrument_device_to_one_instrument_site(y, x) self.rr.create_association.assert_called_once_with( x, PRED.hasDevice, y) rst() self.rr.find_subjects.return_value = (["a", "b"], ["c", "d"]) self.assertRaises( Inconsistent, self.RR2.assign_instrument_device_to_one_instrument_site, y, x) rst() self.rr.find_subjects.return_value = (["a"], ["b"]) self.rr.get_association.return_value = "yay" self.RR2.assign_instrument_device_to_one_instrument_site(y, x) rst() self.rr.find_subjects.return_value = (["a"], ["b"]) self.rr.get_association.side_effect = NotFound("") self.assertRaises( BadRequest, self.RR2.assign_instrument_device_to_one_instrument_site, y, x)
def deactivate_ingestion_configuration(self, ingestion_configuration_id=''): """Deactivate one of the transform processes that uses an ingestion configuration @param ingestion_configuration_id str @throws NotFound The ingestion configuration id did not exist """ log.debug("Deactivating ingestion configuration") # check whether the ingestion configuration object exists #ingestion_configuration = self.read_ingestion_configuration(ingestion_configuration_id) #@todo Should we check to see if the ingestion configuration exists? # use the deactivate method in transformation management service transform_ids, _ = self.clients.resource_registry.find_objects( ingestion_configuration_id, PRED.hasTransform, RT.Transform, True) if len(transform_ids) < 1: raise NotFound('The ingestion configuration %s does not exist' % str(ingestion_configuration_id)) # since all ingestion worker transforms have the same subscription, only deactivate one self.clients.transform_management.deactivate_transform( transform_ids[0]) return True