Example #1
0
 def _validate_task_parameters(cluster_label, tags):
     if not (cluster_label is None or isinstance(cluster_label,
                                                 (str, _six.text_type))):
         raise _FlyteTypeException(
             type(cluster_label),
             {str, _six.text_type},
             additional_msg=
             "cluster_label for a hive task must be in text format",
             received_value=cluster_label,
         )
     if tags is not None:
         if not (isinstance(tags, list) and all(
                 isinstance(tag, (str, _six.text_type)) for tag in tags)):
             raise _FlyteTypeException(
                 type(tags),
                 [],
                 additional_msg=
                 "tags for a hive task must be in 'list of text' format",
                 received_value=tags,
             )
         if len(tags) > ALLOWED_TAGS_COUNT:
             raise _FlyteValueException(
                 len(tags),
                 "number of tags must be less than {}".format(
                     ALLOWED_TAGS_COUNT),
             )
         if not all(len(tag) for tag in tags):
             raise _FlyteValueException(
                 tags,
                 "length of a tag must be less than {} chars".format(
                     MAX_TAG_LENGTH),
             )
Example #2
0
 def _validate_queries(queries_from_task):
     for query_from_task in queries_from_task or []:
         if not isinstance(query_from_task, (str, _six.text_type)):
             raise _FlyteTypeException(
                 type(query_from_task), {str, _six.text_type},
                 additional_msg=
                 "All queries returned from a Hive task must be in text format.",
                 received_value=query_from_task)