batch package¶
Subpackages¶
- batch.configuration package
- batch.definition package
- batch.management package
- batch.messages package
- batch.migrations package
- Submodules
- batch.migrations.0001_initial module
- batch.migrations.0002_auto_20170412_1225 module
- batch.migrations.0003_auto_20170706_1948 module
- batch.migrations.0004_auto_20180122_1444 module
- batch.migrations.0005_auto_20180314_1827 module
- batch.migrations.0006_auto_20180401_0218 module
- batch.migrations.0007_auto_20180516_1915 module
- batch.migrations.0008_auto_20190226_1255 module
- batch.migrations.0009_auto_20190531_1318 module
- Module contents
- batch.test package
Submodules¶
batch.apps module¶
Defines the application configuration for the batch application
batch.exceptions module¶
Defines exceptions that can occur when interacting with batches
-
exception
batch.exceptions.
BatchError
¶ Bases:
exceptions.Exception
Exception indicating that there was a problem with batch processing
batch.models module¶
Defines the database models for a batch
-
class
batch.models.
Batch
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Represents a batch of jobs and recipes to be processed on the cluster
Parameters: - title (
django.db.models.CharField
) – The human-readable name of the batch - description (
django.db.models.TextField
) – An optional description of the batch - recipe_type (
django.db.models.ForeignKey
) – The type of recipe being processed in this batch - recipe_type_rev (
django.db.models.ForeignKey
) – The revision of the recipe type being processed in this batch - event (
django.db.models.ForeignKey
) – The event that triggered the creation of this batch - creator_job (
django.db.models.ForeignKey
) – The job that will create the batch recipes and jobs for processing - definition (
django.contrib.postgres.fields.JSONField
) – JSON definition for what is being processed by this batch - configuration (
django.contrib.postgres.fields.JSONField
) – JSON configuration for running the batch - is_creation_done (
django.db.models.BooleanField
) – Indicates whether all of the recipes for the batch have been created (True) - is_superseded (
django.db.models.BooleanField
) – Indicates whether this batch has been superseded (re-processed by another batch) - root_batch (
django.db.models.ForeignKey
) – The first (root) batch in this chain of iterative batches. This field will be null for the first batch in the chain. - superseded_batch (
django.db.models.OneToOneField
) – The superseded (previous) batch that was re-processed by this batch - jobs_total (
django.db.models.IntegerField
) – The total count of all jobs within the batch - jobs_pending (
django.db.models.IntegerField
) – The count of all PENDING jobs within the batch - jobs_blocked (
django.db.models.IntegerField
) – The count of all BLOCKED jobs within the batch - jobs_queued (
django.db.models.IntegerField
) – The count of all QUEUED jobs within the batch - jobs_running (
django.db.models.IntegerField
) – The count of all RUNNING jobs within the batch - jobs_failed (
django.db.models.IntegerField
) – The count of all FAILED jobs within the batch - jobs_completed (
django.db.models.IntegerField
) – The count of all COMPLETED jobs within the batch - jobs_canceled (
django.db.models.IntegerField
) – The count of all CANCELED jobs within the batch - recipes_estimated (
django.db.models.IntegerField
) – The estimated count for all recipes (including sub-recipes) that will be created for the batch - recipes_total (
django.db.models.IntegerField
) – The total count for all recipes (including sub-recipes) within the batch - recipes_completed (
django.db.models.IntegerField
) – The count for all completed recipes (including sub-recipes) within the batch - created (
django.db.models.DateTimeField
) – When the batch was created - superseded (
django.db.models.DateTimeField
) – When this batch was superseded - last_modified (
django.db.models.DateTimeField
) – When the batch was last modified
-
ALPHABETIZE_FIELDS
= [u'title', u'description']¶
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
conditions_for_batch
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
configuration
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
creator_job
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
creator_job_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
definition
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
event
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
event_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
fileancestrylink_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
get_configuration
()¶ Returns the configuration for this batch
Returns: The configuration for this batch Return type: batch.configuration.configuration.BatchConfiguration
-
get_definition
()¶ Returns the definition for this batch
Returns: The definition for this batch Return type: batch.definition.definition.BatchDefinition
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_next_by_last_modified
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_last_modified
(*moreargs, **morekwargs)¶
-
get_v6_configuration_json
()¶ Returns the batch configuration in v6 of the JSON schema
Returns: The batch configuration in v6 of the JSON schema Return type: dict
-
get_v6_definition_json
()¶ Returns the batch definition in v6 of the JSON schema
Returns: The batch definition in v6 of the JSON schema Return type: dict
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
is_creation_done
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
is_superseded
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobexecution_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
jobs_blocked
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_canceled
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_completed
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_failed
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_for_batch
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
jobs_pending
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_queued
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_running
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_total
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
last_modified
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
linked_batches
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
metrics
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
next_batch
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
place.restaurant
is aReverseOneToOneDescriptor
instance.
-
objects
= <batch.models.BatchManager object>¶
-
queue_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
recipe_type
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
recipe_type_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
recipe_type_rev
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
recipe_type_rev_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
recipes_completed
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
recipes_estimated
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
recipes_for_batch
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
recipes_total
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
root_batch
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
root_batch_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
scalefile_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
superseded
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
superseded_batch
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
restaurant.place
is aForwardOneToOneDescriptor
instance.
-
superseded_batch_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- title (
-
class
batch.models.
BatchManager
¶ Bases:
django.db.models.manager.Manager
Provides additional methods for handling batches
-
calculate_estimated_recipes
(batch, definition)¶ Calculates the estimated number of recipes that will be created for this batch. This number is calculated by: 1. The number of existing recipes for the specific recipe type that are not currently superseded 2. The number of sub-recipes in the recipe. These should be filtered if not changed/marked for re-run?
Parameters: - batch (
batch.models.Batch
) – The batch to calculate recipes for - definition (
batch.definition.definition.BatchDefinition
) – The batch definition
Returns: The number of estimated recipes the batch will create
Return type: int
- batch (
-
create_batch_v6
(title, description, recipe_type, event, definition, configuration=None)¶ Creates a new batch that will contain a collection of recipes to process. The definition and configuration will be stored in version 6 of their respective schemas. This method will only create the batch, not its recipes. To create the batch’s recipes, a CreateBatchRecipes message needs to be sent to the messaging backend.
Parameters: - title (string) – The human-readable name of the batch
- description (string) – A human-readable description of the batch
- recipe_type (
recipe.models.RecipeType
) – The type of recipes that will be created for this batch - event (
trigger.models.TriggerEvent
) – The event that created this batch - definition (
batch.definition.definition.BatchDefinition
) – The definition for running the batch - configuration (
batch.configuration.configuration.BatchConfiguration
) – The batch configuration
Returns: The newly created batch
Return type: :raises
batch.configuration.exceptions.InvalidConfiguration
: If the configuration is invalid :raisesbatch.definition.exceptions.InvalidDefinition
: If the definition is invalid
-
edit_batch_v6
(batch, title=None, description=None, configuration=None)¶ Edits the given batch to update any of the given fields. The configuration will be stored in version 6 of its schemas.
Parameters: - batch (
batch.models.Batch
) – The batch to edit - title (string) – The human-readable name of the batch
- description (string) – A human-readable description of the batch
- configuration (
batch.configuration.configuration.BatchConfiguration
) – The batch configuration
:raises
batch.configuration.exceptions.InvalidConfiguration
: If the configuration is invalid- batch (
-
get_batch_comparison_v6
(root_batch_id)¶ Returns the batch metrics for the v6 batch comparison REST API
Parameters: root_batch_id (int) – The root batch ID of the batches to compare Returns: The list of batches in the chain Return type: list()
-
get_batch_from_root
(root_batch_id)¶ Returns the latest (non-superseded) batch model with the given root batch ID. The returned model will have no related fields populated.
Parameters: root_batch_id (int) – The root batch ID Returns: The batch model Return type: batch.models.Batch
-
get_batches_v6
(started=None, ended=None, recipe_type_ids=None, is_creation_done=None, is_superseded=None, root_batch_ids=None, order=None)¶ Returns a list of batches for the v6 batches REST API
Parameters: - started (
datetime.datetime
) – Query batches updated after this time - ended (
datetime.datetime
) – Query batches updated before this time - recipe_type_ids (
list()
) – Query batches with these recipe types - is_creation_done (bool) – Query batches that match this value
- is_superseded (bool) – Query batches that match this value
- root_batch_ids (
list()
) – Query batches with these root batches - order (
list()
) – A list of fields to control the sort order
Returns: The list of batches that match the given criteria
Return type: list()
- started (
-
get_details_v6
(batch_id)¶ Returns the batch (and related fields) with the given ID for the v6 batch details REST API
Parameters: batch_id (int) – The unique identifier of the batch Returns: The batch with all related fields included Return type: batch.models.Batch
-
get_locked_batch_from_root
(root_batch_id)¶ Locks and returns the latest (non-superseded) batch model with the given root batch ID. The returned model will have no related fields populated. Caller must be within an atomic transaction.
Parameters: root_batch_id (int) – The root batch ID Returns: The batch model Return type: batch.models.Batch
-
mark_creation_done
(batch_id, when)¶ Marks recipe creation as done for this batch
Parameters: - batch_id (int) – The batch ID
- when (
datetime.datetime
) – The current time
-
merge_parameter_map
(batch, dataset)¶ Returns the dataset parameters merged with the batch configuration input map
Parameters: - batch (
batch.models.Batch
) – The batch - dataset (
data.models.DataSet
) – The dataset of the batch
Returns: The map of datasest parameters
Return type: data.interface.Interface
- batch (
-
supersede_batch
(batch_id, when)¶ Updates the given batch to be superseded
Parameters: - batch_id (
list()
) – The batch ID to supersede - when (
datetime.datetime
) – The time that the batch was superseded
- batch_id (
-
update_batch_metrics
(batch_ids)¶ Updates the metrics for the batches with the given IDs
Parameters: batch_ids ( list()
) – The batch IDs
-
validate_batch_v6
(recipe_type, definition, configuration=None)¶ Validates the given recipe type, definition, and configuration for creating a new batch
Parameters: - recipe_type (
recipe.models.RecipeType
) – The type of recipes that will be created for this batch - definition (
batch.definition.definition.BatchDefinition
) – The definition for running the batch - configuration (
batch.configuration.configuration.BatchConfiguration
) – The batch configuration
Returns: The batch validation
Return type: - recipe_type (
-
-
class
batch.models.
BatchMetrics
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Contains a set of metrics for a given job name (“node” within a recipe graph) for a given batch
Parameters: - batch (
django.db.models.ForeignKey
) – The batch - job_name (
django.db.models.CharField
) – The unique name of the job within the batch - jobs_total (
django.db.models.IntegerField
) – The total count of all jobs for this job name within the batch - jobs_pending (
django.db.models.IntegerField
) – The count of all PENDING jobs for this job name within the batch - jobs_blocked (
django.db.models.IntegerField
) – The count of all BLOCKED jobs for this job name within the batch - jobs_queued (
django.db.models.IntegerField
) – The count of all QUEUED jobs for this job name within the batch - jobs_running (
django.db.models.IntegerField
) – The count of all RUNNING jobs for this job name within the batch - jobs_failed (
django.db.models.IntegerField
) – The count of all FAILED jobs for this job name within the batch - jobs_completed (
django.db.models.IntegerField
) – The count of all COMPLETED jobs for this job name within the batch - jobs_canceled (
django.db.models.IntegerField
) – The count of all CANCELED jobs for this job name within the batch - min_seed_duration (
django.db.models.DurationField
) – The shortest Seed run duration for all completed jobs for this job name within the batch - avg_seed_duration (
django.db.models.DurationField
) – The average Seed run duration for all completed jobs for this job name within the batch - max_seed_duration (
django.db.models.DurationField
) – The longest Seed run duration for all completed jobs for this job name within the batch - min_job_duration (
django.db.models.DurationField
) – The shortest job duration for all completed jobs for this job name within the batch - avg_job_duration (
django.db.models.DurationField
) – The average job duration for all completed jobs for this job name within the batch - max_job_duration (
django.db.models.DurationField
) – The longest job duration for all completed jobs for this job name within the batch - created (
django.db.models.DateTimeField
) – When these metrics were created - last_modified (
django.db.models.DateTimeField
) – When these metrics were last modified
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
avg_job_duration
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
avg_seed_duration
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
batch
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
batch_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_next_by_last_modified
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_last_modified
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
job_name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_blocked
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_canceled
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_completed
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_failed
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_pending
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_queued
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_running
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
jobs_total
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
last_modified
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
max_job_duration
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
max_seed_duration
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
min_job_duration
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
min_seed_duration
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <batch.models.BatchMetricsManager object>¶
-
to_dict
()¶ Returns a dict representing these metrics
Returns: The dict representing these metrics Return type: dict
- batch (
-
class
batch.models.
BatchMetricsManager
¶ Bases:
django.db.models.manager.Manager
Provides additional methods for handling batch metrics
-
add_metrics_to_batch
(batch)¶ Adds the metrics per recipe job to the given batch
Parameters: batch ( batch.models.Batch
) – The batch
-
get_batch_metrics
(batch_id)¶ Returns the metrics models for the given batch ID
Parameters: batch_id (int) – The batch ID Returns: The metrics models for the batch Return type: list()
-
update_batch_metrics_per_job
(batch_ids)¶ Updates the metrics per job name for the batches with the given IDs
Parameters: batch_ids ( list()
) – The batch IDs
-
batch.serializers module¶
Defines the serializers for batches
-
class
batch.serializers.
BatchBaseSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
util.rest.ModelIdSerializer
Base serializer for batches
-
class
batch.serializers.
BatchDetailsSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
batch.serializers.BatchSerializerV6
Detailed serializer for a single batch
-
class
RecipeTypeRevisionSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
recipe.serializers.RecipeTypeRevisionBaseSerializerV6
Serializer for recipe type revisions
-
class
TriggerEventDetailsSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
trigger.serializers.TriggerEventBaseSerializerV6
Converts trigger event model fields to REST output.
-
class
-
class
batch.serializers.
BatchSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
batch.serializers.BatchBaseSerializerV6
Serializer for a list of batches
-
class
RecipeTypeBaseSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
util.rest.ModelIdSerializer
Base serializer for recipe types
-
class
RecipeTypeRevisionBaseSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
util.rest.ModelIdSerializer
Base serializer for recipe type revisions
-
class
TriggerEventBaseSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
util.rest.ModelIdSerializer
Converts trigger event model fields to REST output.
-
class
batch.urls module¶
Defines the URLs for the RESTful batch services
batch.views module¶
Defines the views for the RESTful batch services
-
class
batch.views.
BatchDetailsView
(**kwargs)¶ Bases:
rest_framework.generics.RetrieveUpdateAPIView
This view is the endpoint for a specific batch
-
get_serializer_class
()¶ Returns the appropriate serializer based off the requests version of the REST API
-
http_method_names
= [u'get', u'patch', u'head', u'options']¶
-
queryset
¶
-
retrieve
(request, batch_id)¶ Retrieves the details for a batch and returns them in JSON form
Parameters: - request (
rest_framework.request.Request
) – the HTTP GET request - batch_id (int) – The batch ID
Return type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
- request (
-
update
(request, batch_id, **kwargs)¶ Updates the given batch
Parameters: - request (
rest_framework.request.Request
) – the HTTP PATCH request - batch_id (int) – the batch id
Return type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
- request (
-
-
class
batch.views.
BatchesComparisonView
(**kwargs)¶ Bases:
rest_framework.views.APIView
This view is the endpoint for comparing batches with the same root ID (in the same iterative chain)
-
get
(request, root_batch_id)¶ Validates a new batch
Parameters: - request (
rest_framework.request.Request
) – the HTTP GET request - root_batch_id (int) – The root batch ID
Return type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
- request (
-
queryset
¶
-
-
class
batch.views.
BatchesValidationView
(**kwargs)¶ Bases:
rest_framework.views.APIView
This view is the endpoint for validating a new batch before attempting to actually create it
-
post
(request)¶ Validates a new batch
Parameters: request ( rest_framework.request.Request
) – the HTTP POST requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
queryset
¶
-
-
class
batch.views.
BatchesView
(**kwargs)¶ Bases:
rest_framework.generics.ListCreateAPIView
This view is the endpoint for the list of batches
-
create
(request)¶ Creates a new batch and returns a link to the detail URL
Parameters: request ( rest_framework.request.Request
) – the HTTP POST requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
get_serializer_class
()¶ Returns the appropriate serializer based off the requests version of the REST API
-
list
(request)¶ Retrieves the batches and returns them in JSON form
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
queryset
¶
-