MongoDocuments Package

Config

class mongoDocuments.Config(*args, **values)

Bases: mongoengine.document.DynamicDocument

Initialise a document or an embedded document.

Parameters
  • values – A dictionary of keys and values for the document. It may contain additional reserved keywords, e.g. “__auto_convert”.

  • __auto_convert – If True, supplied values will be converted to Python-type values via each field’s to_python method.

  • _created – Indicates whether this is a brand new document or whether it’s already been persisted before. Defaults to true.

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

__objects
_cached_reference_fields = []
_class_name = 'Config'
_collection = None
_db_field_map = {'commitDate': 'commitDate', 'commitMessage': 'commitMessage', 'commitSHA': 'commitSHA', 'compDeleteHash': 'compDeleteHash', 'compImgurLink': 'compImgurLink', 'date': 'date', 'failure': 'failure', 'id': '_id', 'mergedBaseSHA': 'mergedBaseSHA', 'name': 'name', 'perfDeleteHash': 'perfDeleteHash', 'perfImgurLink': 'perfImgurLink', 'setup': 'setup', 'system': 'system', 'unique': 'unique'}
_fields = {'commitDate': <mongoengine.fields.DateTimeField object>, 'commitMessage': <mongoengine.fields.StringField object>, 'commitSHA': <mongoengine.fields.StringField object>, 'compDeleteHash': <mongoengine.fields.StringField object>, 'compImgurLink': <mongoengine.fields.URLField object>, 'date': <mongoengine.fields.DateTimeField object>, 'failure': <mongoengine.fields.StringField object>, 'id': <mongoengine.base.fields.ObjectIdField object>, 'mergedBaseSHA': <mongoengine.fields.StringField object>, 'name': <mongoengine.fields.StringField object>, 'perfDeleteHash': <mongoengine.fields.StringField object>, 'perfImgurLink': <mongoengine.fields.URLField object>, 'setup': <mongoengine.fields.ReferenceField object>, 'system': <mongoengine.fields.StringField object>, 'unique': <mongoengine.fields.StringField object>}
_fields_ordered = ('id', 'name', 'date', 'commitSHA', 'commitDate', 'commitMessage', 'system', 'unique', 'setup', 'perfImgurLink', 'compImgurLink', 'perfDeleteHash', 'compDeleteHash', 'mergedBaseSHA', 'failure')
_is_base_cls = False
_is_document = True
_meta = {'abstract': False, 'allow_inheritance': None, 'collection': 'config', 'delete_rules': None, 'id_field': 'id', 'index_background': False, 'index_opts': None, 'index_specs': [{'fields': [('commitSHA', 1)]}, {'fields': [('unique', 1)], 'unique': True, 'sparse': True}], 'indexes': ['commitSHA'], 'max_documents': None, 'max_size': None, 'ordering': []}
_reverse_db_field_map = {'_id': 'id', 'commitDate': 'commitDate', 'commitMessage': 'commitMessage', 'commitSHA': 'commitSHA', 'compDeleteHash': 'compDeleteHash', 'compImgurLink': 'compImgurLink', 'date': 'date', 'failure': 'failure', 'mergedBaseSHA': 'mergedBaseSHA', 'name': 'name', 'perfDeleteHash': 'perfDeleteHash', 'perfImgurLink': 'perfImgurLink', 'setup': 'setup', 'system': 'system', 'unique': 'unique'}
_subclasses = ('Config',)
_superclasses = ()
_types = ('Config',)
static checkExisting(sha: str) → bool

Check if there already exists a config for a given sha :param sha: SHA to check for

Returns

True if already existing Config

Return type

bool

commitDate

Datetime field.

Uses the python-dateutil library if available alternatively use time.strptime to parse the dates. Note: python-dateutil’s parser is fully featured and when installed you can utilise it to convert varying types of date formats into valid python datetime objects.

Note: To default the field to the current datetime, use: DateTimeField(default=datetime.utcnow)

Note: Microseconds are rounded to the nearest millisecond.

Pre UTC microsecond support is effectively broken. Use ComplexDateTimeField if you need accurate microsecond support.

commitMessage

A unicode string field.

commitSHA

A unicode string field.

compDeleteHash

A unicode string field.

A field that validates input as an URL.

date

Datetime field.

Uses the python-dateutil library if available alternatively use time.strptime to parse the dates. Note: python-dateutil’s parser is fully featured and when installed you can utilise it to convert varying types of date formats into valid python datetime objects.

Note: To default the field to the current datetime, use: DateTimeField(default=datetime.utcnow)

Note: Microseconds are rounded to the nearest millisecond.

Pre UTC microsecond support is effectively broken. Use ComplexDateTimeField if you need accurate microsecond support.

failure

A unicode string field.

id

A field wrapper around MongoDB’s ObjectIds.

mergedBaseSHA

A unicode string field.

name

A unicode string field.

objects

The default QuerySet Manager.

Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a Document class as its first argument, and a QuerySet as its second argument.

The method function should return a QuerySet , probably the same one that was passed in, but modified in some way.

perfDeleteHash

A unicode string field.

A field that validates input as an URL.

setup

A reference to a document that will be automatically dereferenced on access (lazily).

Note this means you will get a database I/O access everytime you access this field. This is necessary because the field returns a Document which precise type can depend of the value of the _cls field present in the document in database. In short, using this type of field can lead to poor performances (especially if you access this field only to retrieve it pk field which is already known before dereference). To solve this you should consider using the LazyReferenceField.

Use the reverse_delete_rule to handle what should happen if the document the field is referencing is deleted. EmbeddedDocuments, DictFields and MapFields does not support reverse_delete_rule and an InvalidDocumentError will be raised if trying to set on one of these Document / Field types.

The options are:

  • DO_NOTHING (0) - don’t do anything (default).

  • NULLIFY (1) - Updates the reference to null.

  • CASCADE (2) - Deletes the documents associated with the reference.

  • DENY (3) - Prevent the deletion of the reference object.

  • PULL (4) - Pull the reference from a ListField of references

Alternative syntax for registering delete rules (useful when implementing bi-directional delete rules)

class Org(Document):
    owner = ReferenceField('User')

class User(Document):
    org = ReferenceField('Org', reverse_delete_rule=CASCADE)

User.register_delete_rule(Org, 'owner', DENY)
system

A unicode string field.

unique

A unicode string field.

QueueObject

class mongoDocuments.QueueObject(*args, **values)

Bases: mongoengine.document.Document

Initialise a document or an embedded document.

Parameters
  • values – A dictionary of keys and values for the document. It may contain additional reserved keywords, e.g. “__auto_convert”.

  • __auto_convert – If True, supplied values will be converted to Python-type values via each field’s to_python method.

  • _created – Indicates whether this is a brand new document or whether it’s already been persisted before. Defaults to true.

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

__objects
_cached_reference_fields = []
_class_name = 'QueueObject'
_collection = None
_db_field_map = {'commitSHA': 'commitSHA', 'compareOptions': 'compareOptions', 'compareUrl': 'compareUrl', 'customCheckpoint': 'customCheckpoint', 'customYaml': 'customYaml', 'id': '_id', 'installID': 'installID', 'job': 'job', 'jobuser': 'jobuser', 'runUrl': 'runUrl', 'running': 'running', 'status': 'status'}
_fields = {'commitSHA': <mongoengine.fields.StringField object>, 'compareOptions': <mongoengine.fields.DictField object>, 'compareUrl': <mongoengine.fields.URLField object>, 'customCheckpoint': <mongoengine.fields.ReferenceField object>, 'customYaml': <mongoengine.fields.ReferenceField object>, 'id': <mongoengine.base.fields.ObjectIdField object>, 'installID': <mongoengine.fields.IntField object>, 'job': <mongoengine.fields.StringField object>, 'jobuser': <mongoengine.fields.StringField object>, 'runUrl': <mongoengine.fields.URLField object>, 'running': <mongoengine.fields.BooleanField object>, 'status': <mongoengine.fields.StringField object>}
_fields_ordered = ('id', 'commitSHA', 'running', 'installID', 'status', 'runUrl', 'compareUrl', 'compareOptions', 'job', 'customYaml', 'customCheckpoint', 'jobuser')
_is_base_cls = False
_is_document = True
_meta = {'abstract': False, 'allow_inheritance': None, 'collection': 'queue_object', 'delete_rules': None, 'id_field': 'id', 'index_background': False, 'index_opts': None, 'index_specs': [{'fields': [('commitSHA', 1)]}, {'fields': [('commitSHA', 1), ('job', 1)], 'unique': True, 'sparse': False}], 'indexes': ['commitSHA'], 'max_documents': None, 'max_size': None, 'ordering': []}
_reverse_db_field_map = {'_id': 'id', 'commitSHA': 'commitSHA', 'compareOptions': 'compareOptions', 'compareUrl': 'compareUrl', 'customCheckpoint': 'customCheckpoint', 'customYaml': 'customYaml', 'installID': 'installID', 'job': 'job', 'jobuser': 'jobuser', 'runUrl': 'runUrl', 'running': 'running', 'status': 'status'}
_subclasses = ('QueueObject',)
_superclasses = ()
_types = ('QueueObject',)
commitSHA

A unicode string field.

compareOptions

A dictionary field that wraps a standard Python dictionary. This is similar to an embedded document, but the structure is not defined.

Note

Required means it cannot be empty - as the default for DictFields is {}

compareUrl

A field that validates input as an URL.

customCheckpoint

A reference to a document that will be automatically dereferenced on access (lazily).

Note this means you will get a database I/O access everytime you access this field. This is necessary because the field returns a Document which precise type can depend of the value of the _cls field present in the document in database. In short, using this type of field can lead to poor performances (especially if you access this field only to retrieve it pk field which is already known before dereference). To solve this you should consider using the LazyReferenceField.

Use the reverse_delete_rule to handle what should happen if the document the field is referencing is deleted. EmbeddedDocuments, DictFields and MapFields does not support reverse_delete_rule and an InvalidDocumentError will be raised if trying to set on one of these Document / Field types.

The options are:

  • DO_NOTHING (0) - don’t do anything (default).

  • NULLIFY (1) - Updates the reference to null.

  • CASCADE (2) - Deletes the documents associated with the reference.

  • DENY (3) - Prevent the deletion of the reference object.

  • PULL (4) - Pull the reference from a ListField of references

Alternative syntax for registering delete rules (useful when implementing bi-directional delete rules)

class Org(Document):
    owner = ReferenceField('User')

class User(Document):
    org = ReferenceField('Org', reverse_delete_rule=CASCADE)

User.register_delete_rule(Org, 'owner', DENY)
customYaml

A reference to a document that will be automatically dereferenced on access (lazily).

Note this means you will get a database I/O access everytime you access this field. This is necessary because the field returns a Document which precise type can depend of the value of the _cls field present in the document in database. In short, using this type of field can lead to poor performances (especially if you access this field only to retrieve it pk field which is already known before dereference). To solve this you should consider using the LazyReferenceField.

Use the reverse_delete_rule to handle what should happen if the document the field is referencing is deleted. EmbeddedDocuments, DictFields and MapFields does not support reverse_delete_rule and an InvalidDocumentError will be raised if trying to set on one of these Document / Field types.

The options are:

  • DO_NOTHING (0) - don’t do anything (default).

  • NULLIFY (1) - Updates the reference to null.

  • CASCADE (2) - Deletes the documents associated with the reference.

  • DENY (3) - Prevent the deletion of the reference object.

  • PULL (4) - Pull the reference from a ListField of references

Alternative syntax for registering delete rules (useful when implementing bi-directional delete rules)

class Org(Document):
    owner = ReferenceField('User')

class User(Document):
    org = ReferenceField('Org', reverse_delete_rule=CASCADE)

User.register_delete_rule(Org, 'owner', DENY)
id

A field wrapper around MongoDB’s ObjectIds.

installID

32-bit integer field.

job

A unicode string field.

jobuser

A unicode string field.

objects

The default QuerySet Manager.

Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a Document class as its first argument, and a QuerySet as its second argument.

The method function should return a QuerySet , probably the same one that was passed in, but modified in some way.

runUrl

A field that validates input as an URL.

running

Boolean field type.

status

A unicode string field.

Result

class mongoDocuments.Result(*args, **values)

Bases: mongoengine.document.DynamicDocument

Holding results for a given config

Initialise a document or an embedded document.

Parameters
  • values – A dictionary of keys and values for the document. It may contain additional reserved keywords, e.g. “__auto_convert”.

  • __auto_convert – If True, supplied values will be converted to Python-type values via each field’s to_python method.

  • _created – Indicates whether this is a brand new document or whether it’s already been persisted before. Defaults to true.

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

__objects
_cached_reference_fields = []
_class_name = 'Result'
_collection = None
_db_field_map = {'config': 'config', 'id': '_id', 'meanTime': 'meanTime', 'measurements': 'measurements', 'minTime': 'minTime'}
_fields = {'config': <mongoengine.fields.ReferenceField object>, 'id': <mongoengine.base.fields.ObjectIdField object>, 'meanTime': <mongoengine.fields.FloatField object>, 'measurements': <mongoengine.fields.ListField object>, 'minTime': <mongoengine.fields.FloatField object>}
_fields_ordered = ('id', 'config', 'measurements', 'meanTime', 'minTime')
_is_base_cls = False
_is_document = True
_meta = {'abstract': False, 'allow_inheritance': None, 'collection': 'result', 'delete_rules': None, 'id_field': 'id', 'index_background': False, 'index_opts': None, 'index_specs': [{'fields': [('config', 1)]}, {'fields': [('config', 'hashed')]}, {'fields': [('dynamic_Container', 1)]}, {'fields': [('dynamic_CellSizeFactor', 1)]}, {'fields': [('dynamic_DataLayout', 1)]}, {'fields': [('dynamic_Traversal', 1)]}, {'fields': [('dynamic_Newton3', 1)]}, {'fields': [('dynamic_LoadEstimator', 1)]}, {'fields': [('config', 1), ('dynamic_Container', 1)], 'name': 'compound0'}, {'fields': [('config', 1), ('dynamic_Container', 1), ('dynamic_DataLayout', 1)], 'name': 'compound1'}, {'fields': [('config', 1), ('dynamic_Container', 1), ('dynamic_DataLayout', 1), ('dynamic_Traversal', 1)], 'name': 'compound2'}, {'fields': [('config', 1), ('dynamic_Container', 1), ('dynamic_DataLayout', 1), ('dynamic_Traversal', 1), ('dynamic_Newton3', 1)], 'name': 'compound3'}, {'fields': [('config', 1), ('dynamic_Container', 1), ('dynamic_DataLayout', 1), ('dynamic_Traversal', 1), ('dynamic_Newton3', 1), ('dynamic_CellSizeFactor', 1)], 'name': 'compound4'}, {'fields': [('config', 1), ('dynamic_Container', 1), ('dynamic_DataLayout', 1), ('dynamic_Traversal', 1), ('dynamic_Newton3', 1), ('dynamic_CellSizeFactor', 1), ('dynamic_LoadEstimator', 1)], 'name': 'compound5'}], 'indexes': ['config', '#config', 'dynamic_Container', 'dynamic_CellSizeFactor', 'dynamic_DataLayout', 'dynamic_Traversal', 'dynamic_Newton3', 'dynamic_LoadEstimator', {'fields': ['config', 'dynamic_Container'], 'name': 'compound0'}, {'fields': ['config', 'dynamic_Container', 'dynamic_DataLayout'], 'name': 'compound1'}, {'fields': ['config', 'dynamic_Container', 'dynamic_DataLayout', 'dynamic_Traversal'], 'name': 'compound2'}, {'fields': ['config', 'dynamic_Container', 'dynamic_DataLayout', 'dynamic_Traversal', 'dynamic_Newton3'], 'name': 'compound3'}, {'fields': ['config', 'dynamic_Container', 'dynamic_DataLayout', 'dynamic_Traversal', 'dynamic_Newton3', 'dynamic_CellSizeFactor'], 'name': 'compound4'}, {'fields': ['config', 'dynamic_Container', 'dynamic_DataLayout', 'dynamic_Traversal', 'dynamic_Newton3', 'dynamic_CellSizeFactor', 'dynamic_LoadEstimator'], 'name': 'compound5'}], 'max_documents': None, 'max_size': None, 'ordering': []}
_reverse_db_field_map = {'_id': 'id', 'config': 'config', 'meanTime': 'meanTime', 'measurements': 'measurements', 'minTime': 'minTime'}
_subclasses = ('Result',)
_superclasses = ()
_types = ('Result',)
config

A reference to a document that will be automatically dereferenced on access (lazily).

Note this means you will get a database I/O access everytime you access this field. This is necessary because the field returns a Document which precise type can depend of the value of the _cls field present in the document in database. In short, using this type of field can lead to poor performances (especially if you access this field only to retrieve it pk field which is already known before dereference). To solve this you should consider using the LazyReferenceField.

Use the reverse_delete_rule to handle what should happen if the document the field is referencing is deleted. EmbeddedDocuments, DictFields and MapFields does not support reverse_delete_rule and an InvalidDocumentError will be raised if trying to set on one of these Document / Field types.

The options are:

  • DO_NOTHING (0) - don’t do anything (default).

  • NULLIFY (1) - Updates the reference to null.

  • CASCADE (2) - Deletes the documents associated with the reference.

  • DENY (3) - Prevent the deletion of the reference object.

  • PULL (4) - Pull the reference from a ListField of references

Alternative syntax for registering delete rules (useful when implementing bi-directional delete rules)

class Org(Document):
    owner = ReferenceField('User')

class User(Document):
    org = ReferenceField('Org', reverse_delete_rule=CASCADE)

User.register_delete_rule(Org, 'owner', DENY)
id

A field wrapper around MongoDB’s ObjectIds.

meanTime

Floating point number field.

measurements

A list field that wraps a standard field, allowing multiple instances of the field to be used as a list in the database.

If using with ReferenceFields see: many-to-many-with-listfields

Note

Required means it cannot be empty - as the default for ListFields is []

minTime

Floating point number field.

objects

The default QuerySet Manager.

Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a Document class as its first argument, and a QuerySet as its second argument.

The method function should return a QuerySet , probably the same one that was passed in, but modified in some way.

Setup

class mongoDocuments.Setup(*args, **values)

Bases: mongoengine.document.DynamicDocument

Holding .yaml file used for performance testing runs

Initialise a document or an embedded document.

Parameters
  • values – A dictionary of keys and values for the document. It may contain additional reserved keywords, e.g. “__auto_convert”.

  • __auto_convert – If True, supplied values will be converted to Python-type values via each field’s to_python method.

  • _created – Indicates whether this is a brand new document or whether it’s already been persisted before. Defaults to true.

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

__objects
_cached_reference_fields = []
_class_name = 'Setup'
_collection = None
_db_field_map = {'active': 'active', 'id': '_id', 'name': 'name', 'uploadDate': 'uploadDate', 'yaml': 'yaml', 'yamlHash': 'yamlHash'}
_fields = {'active': <mongoengine.fields.BooleanField object>, 'id': <mongoengine.base.fields.ObjectIdField object>, 'name': <mongoengine.fields.StringField object>, 'uploadDate': <mongoengine.fields.DateTimeField object>, 'yaml': <mongoengine.fields.StringField object>, 'yamlHash': <mongoengine.fields.StringField object>}
_fields_ordered = ('id', 'name', 'yaml', 'yamlHash', 'active', 'uploadDate')
_is_base_cls = False
_is_document = True
_meta = {'abstract': False, 'allow_inheritance': None, 'collection': 'setup', 'delete_rules': None, 'id_field': 'id', 'index_background': False, 'index_opts': None, 'index_specs': [{'fields': [('yamlHash', 1)], 'unique': True, 'sparse': False}], 'indexes': [], 'max_documents': None, 'max_size': None, 'ordering': []}
_reverse_db_field_map = {'_id': 'id', 'active': 'active', 'name': 'name', 'uploadDate': 'uploadDate', 'yaml': 'yaml', 'yamlHash': 'yamlHash'}
_subclasses = ('Setup',)
_superclasses = ()
_types = ('Setup',)
active

Boolean field type.

id

A field wrapper around MongoDB’s ObjectIds.

name

A unicode string field.

objects

The default QuerySet Manager.

Custom QuerySet Manager functions can extend this class and users can add extra queryset functionality. Any custom manager methods must accept a Document class as its first argument, and a QuerySet as its second argument.

The method function should return a QuerySet , probably the same one that was passed in, but modified in some way.

uploadDate

Datetime field.

Uses the python-dateutil library if available alternatively use time.strptime to parse the dates. Note: python-dateutil’s parser is fully featured and when installed you can utilise it to convert varying types of date formats into valid python datetime objects.

Note: To default the field to the current datetime, use: DateTimeField(default=datetime.utcnow)

Note: Microseconds are rounded to the nearest millisecond.

Pre UTC microsecond support is effectively broken. Use ComplexDateTimeField if you need accurate microsecond support.

yaml

A unicode string field.

yamlHash

A unicode string field.