# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function

from django.core.exceptions import ValidationError
from polyaxon_schemas.exceptions import PolyaxonfileError, PolyaxonConfigurationError
from polyaxon_schemas.polyaxonfile.specification import GroupSpecification


def validate_spec_content(content):
    try:
        spec = GroupSpecification.read(content)
    except (PolyaxonfileError, PolyaxonConfigurationError):
        raise ValidationError('Received non valid specification content.')

    if spec.is_local:
        raise ValidationError('Received specification content for a local environment run.')

    return spec

@@ -294,16 +294,177 @@
 fication
+, Specification%0A%0A%0Adef validate_run_type(spec):%0A    if spec.is_local:%0A        raise ValidationError('Received specification content for a local environment run.')
 %0A%0A%0Adef v
@@ -695,117 +695,325 @@
     
-if spec.is_local:%0A        raise ValidationError('Received specification content for a local environment run.'
+validate_run_type(spec)%0A%0A    return spec%0A%0A%0Adef validate_tensorboard_spec_content(content):%0A    try:%0A        spec = Specification.read(content)%0A    except (PolyaxonfileError, PolyaxonConfigurationError):%0A        raise ValidationError('Received non valid tensorboard specification content.')%0A%0A    validate_run_type(spec
 )%0A%0A 

Add tensorboard serializer * Add validation * Add tests