Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(102)  |  Call(73)  |  Derive(0)  |  Import(29)

src/p/y/pyon-HEAD/pyon/datastore/couchbase/base_store.py   pyon(Download)
from pyon.datastore.couchdb.couch_common import AbstractCouchDataStore
from pyon.datastore.couchbase.views import get_couch_view_designs
from pyon.core.exception import BadRequest, Conflict, NotFound, ServerError
from pyon.util.containers import get_safe, DictDiffer
 
        try:
            if not self.datastore_exists(datastore_name):
                raise NotFound("Datastore '%s' does not exist" % ds_name)
 
            ds = self.server[ds_name]   # Note: causes http lookup
    def delete_datastore(self, datastore_name=None):
        try:
            super(CouchbaseDataStore, self).delete_datastore(datastore_name)
        except BucketUnavailableException as e:
            raise NotFound('Couchbase unable to delete bucket named %s on %s. Exception: %s ' % (
            opaque, cas, msg = ds.set(doc_id, 0, 0, doc)
        except MemcachedError as ex:
            raise NotFound('Object %s could not be created: %s' % (doc_id, ex))
        return doc_id, cas
 
        doc_id = doc if isinstance(doc, str) else doc.get('_id',None)
        if not doc_id:
            raise NotFound("document id is not found in the document for attachment")
 
        # Update the document to include the attachment id

src/p/y/pyon-HEAD/pyon/datastore/couchdb/base_store.py   pyon(Download)
from pyon.datastore.couchdb.couch_common import AbstractCouchDataStore
from pyon.datastore.couchdb.views import get_couchdb_view_designs
from pyon.core.exception import BadRequest, Conflict, NotFound
from pyon.util.containers import get_safe, DictDiffer
 
            return ds, datastore_name
        except ResourceNotFound:
            raise NotFound("Datastore '%s' does not exist" % datastore_name)
        except ValueError:
            raise BadRequest("Datastore name '%s' invalid" % datastore_name)
    def delete_datastore(self, datastore_name=None):
        try:
            super(CouchDataStore, self).delete_datastore(datastore_name)
        except ResourceNotFound:
            raise NotFound('Datastore %s does not exist' % datastore_name)
            doc = ds.get(doc_id)
            if doc is None:
                raise NotFound('Object with id %s does not exist.' % doc_id)
        else:
            # There was an issue with couchdb_python 0.8 and concurrent use of this library
            # See https://code.google.com/p/couchdb-python/issues/detail?id=204
            # Fixed in client 0.9
            doc = ds.get(doc_id, rev=rev_id)
            if doc is None:
                raise NotFound('Object with id %s does not exist.' % doc_id)

src/p/y/pyon-HEAD/pyon/datastore/postgresql/base_store.py   pyon(Download)
from ooi.logging import log
 
from pyon.core.exception import BadRequest, Conflict, NotFound, Inconsistent
from pyon.datastore.datastore_common import DataStore
from pyon.datastore.datastore_query import DQ
                cur.execute(statement, statement_args)
            except IntegrityError:
                raise NotFound('Object with id %s does not exist.' % doc_id)
 
    def update_doc(self, doc, datastore_name=None):
            cur.execute(statement, statement_args)
            if not cur.rowcount:
                raise NotFound('Attachment %s for object with id %s does not exist.' % (attachment_name, doc_id))
 
    def read_doc(self, doc_id, rev_id=None, datastore_name=None, object_type=None):
            doc_list = cur.fetchall()
            if not doc_list:
                raise NotFound('Object with id %s does not exist.' % doc_id)
            if len(doc_list) > 1:
                raise Inconsistent('Object with id %s has %s values.' % (doc_id, len(doc_list)))
            doc_list = cur.fetchall()
            if not doc_list:
                raise NotFound('Object with id %s does not exist.' % doc_id)
 
            rev = doc_list[0][0]

src/p/y/pyon-HEAD/pyon/ion/resource.py   pyon(Download)
from pyon.core.registry import getextends, issubtype, is_ion_object, isenum
from pyon.core.bootstrap import IonObject
from pyon.core.exception import BadRequest, NotFound, Inconsistent, Unauthorized
from pyon.util.config import Config
from pyon.util.containers import DotDict, named_any, get_ion_ts
 
        if not resource_object:
            raise NotFound("The Resource %s does not exist" % resource_id)
 
        res_container = IonObject(extended_resource_type)
        origin_resource_decorator =  resource_data.get_class_decorator_value('OriginResourceType')
        if origin_resource_decorator is None and origin_resource_type is None:
            raise NotFound('OriginResourceType decorator not found in object specification %s', prepare_resource_type)
 
        origin_resource_type = origin_resource_type if origin_resource_type is not None else origin_resource_decorator
        if origin_resource_type is None:
            raise NotFound('OriginResourceType decorator not found in object specification %s', prepare_resource_type)

src/p/y/pyon-HEAD/pyon/ion/resregistry.py   pyon(Download)
from pyon.core import bootstrap
from pyon.core.bootstrap import IonObject, CFG
from pyon.core.exception import BadRequest, NotFound, Inconsistent
from pyon.core.object import IonObjectBase
from pyon.core.registry import getextends
    def delete(self, object_id='', del_associations=False):
        res_obj = self.read(object_id)
        if not res_obj:
            raise NotFound("Resource %s does not exist" % object_id)
 
                new_s = res_by_id[s]
                if not new_s:
                    raise NotFound("Subject %s not found" % s)
            else:
                if "_id" not in s:
                    raise BadRequest("Subject id not available")
            if type(o) is str:
                new_o = res_by_id[o]
                if not new_o:
                    raise NotFound("Object %s not found" % o)
            obj_list, assoc_list = self.find_objects(subject=subject, predicate=predicate, object_type=object_type, id_only=True)
            if not obj_list:
                raise NotFound("No object found for subject=%s, predicate=%s, object_type=%s" % (subject, predicate, object_type))
            elif len(obj_list) > 1:
                raise Inconsistent("More than one object found for subject=%s, predicate=%s, object_type=%s: count=%s" % (

src/p/y/pyon-HEAD/pyon/datastore/couchdb/couchdb_standalone.py   pyon(Download)
from couchdb.http import PreconditionFailed, ResourceConflict, ResourceNotFound, ServerError
 
from pyon.core.exception import BadRequest, Conflict, NotFound
from pyon.util.containers import get_safe, DictDiffer
 
            return ds, datastore_name
        except ResourceNotFound:
            raise NotFound("Data store '%s' does not exist" % datastore_name)
        except ValueError:
            raise BadRequest("Data store name '%s' invalid" % datastore_name)
            self.server.delete(datastore_name)
        except ResourceNotFound:
            raise NotFound('Data store %s does not exist' % datastore_name)
        except ValueError:
            raise BadRequest("Data store name %s invalid" % datastore_name)
            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)

src/p/y/pyon-HEAD/prototype/hdf/hdf_array_iterator.py   pyon(Download)
 
from operator import mul
from pyon.core.exception import NotFound, BadRequest
from pyon.public import log
import itertools
 
    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')
 
    if len(dataset_lists_by_name.keys()) == 0:
        raise NotFound('No dataset for the variables provided were found in the hdf files.')
 
    for vname, dset_list in dataset_lists_by_name.iteritems():

src/p/y/pyon-HEAD/pyon/datastore/filestore/filestore.py   pyon(Download)
from pyon.core import bootstrap
from pyon.core.bootstrap import get_obj_registry, CFG
from pyon.core.exception import BadRequest, NotFound, Inconsistent
from pyon.core.object import IonObjectBase
from pyon.ion.event import EventPublisher
            doc = json.loads(doc_json)
        if doc is None:
            raise NotFound('Object with id %s does not exist.' % str(doc_id))
        log.debug('read doc contents: %s', doc)
        return doc
            os.remove(filename)
        except OSError:
            raise NotFound('Object with id %s does not exist.' % doc_id)
 
    def _ion_object_to_persistence_dict(self, ion_object):

src/p/y/pyon-HEAD/pyon/agent/agent.py   pyon(Download)
from pyon.core.exception import BadRequest
from pyon.core.exception import Conflict
from pyon.core.exception import NotFound
from pyon.core.exception import ServerError
 
            else:
                log.debug("No agent process found for resource_id %s" % self.resource_id)
                raise NotFound("No agent process found for resource_id %s" % self.resource_id)
        else:
            self.agent_process_id = kwargs.pop("name")

src/p/y/pyon-HEAD/pyon/agent/simple_agent.py   pyon(Download)
        else:
            log.info("Agent command not supported: %s" % (command.command))
            ex = iex.NotFound("Command not supported: %s" % command.command)
            cmd_res.status = iex.NotFound.status_code
            cmd_res.result = str(ex)
    def set_param(self, resource_id="", name='', value=''):
        if not hasattr(self, "rpar_%s" % name):
            raise iex.NotFound('Resource parameter not existing: %s' % name)
        pvalue = getattr(self, "rpar_%s" % name)
        setattr(self, "rpar_%s" % name, value)
    def get_param(self, resource_id="", name=''):
        try:
            return getattr(self, "rpar_%s" % name)
        except AttributeError:
            raise iex.NotFound('Resource parameter not found: %s' % name)
 
    def set_agent_param(self, resource_id="", name='', value=''):
        if not hasattr(self, "apar_%s" % name):
            raise iex.NotFound('Agent parameter not existing: %s' % name)
    def get_agent_param(self, resource_id="", name=''):
        try:
            return getattr(self, "apar_%s" % name)
        except AttributeError:
            raise iex.NotFound('Agent parameter not found: %s' % name)

  1 | 2 | 3  Next