예제 #1
0
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)
예제 #2
0
class JobTypeFailedStatusSerializer(serializers.Serializer):
    """Converts job type failed status model and extra statistic fields to REST output."""
    from error.serializers import ErrorSerializer

    job_type = JobTypeBaseSerializer()
    error = ErrorSerializer()
    count = serializers.IntegerField()
    first_error = serializers.DateTimeField()
    last_error = serializers.DateTimeField()
예제 #3
0
class JobExecutionDetailsSerializerV5(JobExecutionSerializerV5):
    """Converts job execution model fields to REST output"""

    from error.serializers import ErrorSerializer
    from node.serializers import NodeSerializerV4

    job = JobSerializerV5()
    node = NodeSerializerV4()
    error = ErrorSerializer(source='jobexecutionend.error')
예제 #4
0
class JobTypeDetailsSerializer(JobTypeSerializer):
    """Converts job type model fields to REST output."""
    from error.serializers import ErrorSerializer
    from trigger.serializers import TriggerRuleDetailsSerializer

    interface = serializers.JSONField(default=dict)
    error_mapping = serializers.JSONField(default=dict)
    errors = ErrorSerializer(many=True)
    trigger_rule = TriggerRuleDetailsSerializer()

    job_counts_6h = JobTypeStatusCountsSerializer(many=True)
    job_counts_12h = JobTypeStatusCountsSerializer(many=True)
    job_counts_24h = JobTypeStatusCountsSerializer(many=True)
예제 #5
0
class JobTypeDetailsSerializerV5(JobTypeSerializerV5):
    """Converts job type model fields to REST output for legacy job types."""
    from error.serializers import ErrorSerializer
    from trigger.serializers import TriggerRuleDetailsSerializer

    interface = serializers.JSONField(default=dict, source='manifest')

    configuration = serializers.JSONField(default=dict)
    custom_resources = serializers.JSONField(source='convert_custom_resources')
    error_mapping = serializers.JSONField(default=dict)
    errors = ErrorSerializer(many=True)
    trigger_rule = TriggerRuleDetailsSerializer()

    job_counts_6h = JobTypeStatusCountsSerializer(many=True)
    job_counts_12h = JobTypeStatusCountsSerializer(many=True)
    job_counts_24h = JobTypeStatusCountsSerializer(many=True)
예제 #6
0
class JobExecutionDetailsSerializer(JobExecutionSerializer):
    """Converts job execution model fields to REST output"""
    from error.serializers import ErrorSerializer
    from node.serializers import NodeSerializerV4

    job = JobSerializer()
    node = NodeSerializerV4()
    error = ErrorSerializer()

    environment = serializers.JSONField(default=dict)
    cpus_scheduled = serializers.FloatField()
    mem_scheduled = serializers.FloatField()
    disk_in_scheduled = serializers.FloatField()
    disk_out_scheduled = serializers.FloatField()
    disk_total_scheduled = serializers.FloatField()

    results = serializers.JSONField(default=dict)

    results_manifest = serializers.JSONField(default=dict)
예제 #7
0
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 = []
예제 #8
0
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()