class JobDetailsSerializer(JobSerializer): """Converts job model and related fields to REST output.""" from error.serializers import ErrorSerializer from trigger.serializers import TriggerEventDetailsSerializer job_type = JobTypeSerializer() job_type_rev = JobTypeRevisionSerializer() event = TriggerEventDetailsSerializer() error = ErrorSerializer() data = serializers.JSONField(default=dict) results = serializers.JSONField(default=dict) root_superseded_job = JobBaseSerializer() superseded_job = JobBaseSerializer() superseded_by_job = JobBaseSerializer() # Attempt to serialize related model fields # Use a localized import to make higher level application dependencies optional try: from recipe.serializers import RecipeSerializer recipes = RecipeSerializer(many=True) except: recipes = [] job_exes = JobExecutionBaseSerializer(many=True) inputs = JobDetailsInputSerializer(many=True) outputs = JobDetailsOutputSerializer(many=True)
class BatchDetailsSerializerV5(BatchSerializerV5): """Converts batch model fields to REST output.""" from job.serializers import JobSerializerV5 from recipe.serializers import RecipeTypeSerializer from trigger.serializers import TriggerEventDetailsSerializer recipe_type = RecipeTypeSerializer() event = TriggerEventDetailsSerializer() creator_job = JobSerializerV5() definition = serializers.JSONField(source='get_old_definition_json')
class BatchDetailsSerializer(BatchSerializer): """Converts batch model fields to REST output.""" from job.serializers import JobSerializer from recipe.serializers import RecipeTypeSerializer from trigger.serializers import TriggerEventDetailsSerializer recipe_type = RecipeTypeSerializer() event = TriggerEventDetailsSerializer() creator_job = JobSerializer() definition = serializers.JSONField(default=dict)
class RecipeDetailsSerializer(RecipeSerializer): """Converts related recipe model fields to REST output.""" from storage.serializers import ScaleFileBaseSerializer from trigger.serializers import TriggerEventDetailsSerializer recipe_type = RecipeTypeSerializer() recipe_type_rev = RecipeTypeRevisionSerializer() event = TriggerEventDetailsSerializer() data = serializers.JSONField() input_files = ScaleFileBaseSerializer(many=True) jobs = RecipeJobsDetailsSerializer(many=True)
class BatchDetailsSerializerV6(BatchSerializerV6): """Detailed serializer for a single batch""" from recipe.serializers import RecipeTypeRevisionSerializerV6 from trigger.serializers import TriggerEventDetailsSerializer recipe_type_rev = RecipeTypeRevisionSerializerV6() event = TriggerEventDetailsSerializer() definition = serializers.JSONField(source='get_v6_definition_json') configuration = serializers.JSONField(source='get_v6_configuration_json') job_metrics = serializers.JSONField()
class RecipeDetailsSerializer(RecipeSerializer): """Converts related recipe model fields to REST output.""" from trigger.serializers import TriggerEventDetailsSerializer recipe_type_rev = RecipeTypeRevisionSerializer() event = TriggerEventDetailsSerializer() input = serializers.JSONField(default=dict) jobs = RecipeJobsDetailsSerializer(many=True) root_superseded_recipe = RecipeBaseSerializer() superseded_recipe = RecipeBaseSerializer() superseded_by_recipe = RecipeBaseSerializer()
class JobDetailsSerializer(JobSerializer): """Converts job model and related fields to REST output.""" from error.serializers import ErrorSerializer from storage.serializers import ScaleFileBaseSerializer from trigger.serializers import TriggerEventDetailsSerializer job_type = JobTypeSerializer() job_type_rev = JobTypeRevisionSerializer() event = TriggerEventDetailsSerializer() error = ErrorSerializer() data = serializers.JSONField() results = serializers.JSONField() root_superseded_job = JobBaseSerializer() superseded_job = JobBaseSerializer() superseded_by_job = JobBaseSerializer() # Attempt to serialize related model fields # Use a localized import to make higher level application dependencies optional try: from recipe.serializers import RecipeSerializer recipes = RecipeSerializer(many=True) except: recipes = [] job_exes = JobExecutionBaseSerializer(many=True) inputs = JobDetailsInputSerializer(many=True) outputs = JobDetailsOutputSerializer(many=True) # TODO Remove this attribute once the UI migrates to "inputs" input_files = ScaleFileBaseSerializer(many=True) # TODO Remove this attribute once the UI migrates to "outputs" try: from product.serializers import ProductFileBaseSerializer products = ProductFileBaseSerializer(many=True) except: products = []
class JobDetailsSerializerV6(JobSerializerV6): """Converts job model and related fields to REST output.""" from error.serializers import ErrorSerializer from trigger.serializers import TriggerEventDetailsSerializer job_type = JobTypeSerializerV6() job_type_rev = JobTypeRevisionSerializerV6() event = TriggerEventDetailsSerializer() error = ErrorSerializer() try: from recipe.serializers import RecipeBaseSerializer recipe = RecipeBaseSerializer() except: recipe = {} input = serializers.JSONField(default=dict) output = serializers.JSONField(default=dict) execution = JobExecutionBaseSerializerV6() root_superseded_job = JobBaseSerializerV6() superseded_job = JobBaseSerializerV6() superseded_by_job = JobBaseSerializerV6()