Example #1
0
    def test_create(self):
        with patch.object(Layer1, "register_activity_type"):
            new_activity_type = ActivityType(self.domain, "TestActivityType",
                                             "0.test")

            self.assertIsNotNone(new_activity_type)
            self.assertIsInstance(new_activity_type, ActivityType)
Example #2
0
 def to_ActivityType(self, domain, type_info, **kwargs):
     return ActivityType(
         domain,
         type_info["activityType"]["name"],
         type_info["activityType"]["version"],
         status=type_info.get("status"),
         description=type_info.get("description"),
         creation_date=type_info.get("creationDate"),
         deprecation_date=type_info.get("deprecationDate"),
         **kwargs
     )
Example #3
0
 def to_ActivityType(self, domain, type_info, **kwargs):
     return ActivityType(
         domain,
         type_info['activityType']['name'],
         type_info['activityType']['version'],
         status=type_info.get('status'),
         description=type_info.get('description'),
         creation_date=type_info.get('creationDate'),
         deprecation_date=type_info.get('deprecationDate'),
         **kwargs
     )
Example #4
0
    def create(
        self,
        name,
        version,
        status=REGISTERED,
        description=None,
        creation_date=0.0,
        deprecation_date=0.0,
        task_list=None,
        task_heartbeat_timeout=0,
        task_schedule_to_close_timeout=0,
        task_schedule_to_start_timeout=0,
        task_start_to_close_timeout=0,
        *args,
        **kwargs
    ):
        """Creates a new remote activity type and returns the
        created ActivityType model instance.

        :param  name: name of the ActivityType
        :type   name: str

        :param  version: version of the ActivityType
        :type   version: str

        :param  status: ActivityType status
        :type   status: swf.constants.{REGISTERED, DEPRECATED}

        :param  description: ActivityType description
        :type   description: str | None

        :param   creation_date: creation date of the current ActivityType
        :type    creation_date: float (timestamp)

        :param   deprecation_date: deprecation date of ActivityType
        :type    deprecation_date: float (timestamp)

        :param  task_list: specifies the default task list to use for scheduling
                           tasks of this activity type.
        :type   task_list: str

        :param  task_heartbeat_timeout: default maximum time before which a worker
                                        processing a task of this type must report
                                        progress by calling RecordActivityTaskHeartbeat.
        :type   task_heartbeat_timeout: int

        :param  task_schedule_to_close_timeout: default maximum duration for a task
                                                of this activity type.
        :type   task_schedule_to_close_timeout: int

        :param  task_schedule_to_start_timeout: default maximum duration that a
                                                task of this activity type can wait
                                                before being assigned to a worker.
        :type   task_schedule_to_start_timeout: int

        :param   task_start_to_close_timeout: default maximum duration that a
                                              worker can take to process tasks of
                                              this activity type.
        :type    task_start_to_close_timeout: int
        """
        activity_type = ActivityType(
            self.domain,
            name,
            version,
            status=status,
            description=description,
            creation_date=creation_date,
            deprecation_date=deprecation_date,
            task_list=task_list,
            task_heartbeat_timeout=task_heartbeat_timeout,
            task_schedule_to_close_timeout=task_schedule_to_close_timeout,
            task_schedule_to_start_timeout=task_schedule_to_start_timeout,
            task_start_to_close_timeout=task_start_to_close_timeout,
        )
        activity_type.save()

        return activity_type
    def create(self, name, version,
               status=REGISTERED,
               description=None,
               creation_date=0.0,
               deprecation_date=0.0,
               task_list=None,
               task_heartbeat_timeout=0,
               task_schedule_to_close_timeout=0,
               task_schedule_to_start_timeout=0,
               task_start_to_close_timeout=0,
               *args, **kwargs):
        """Creates a new remote activity type and returns the
        created ActivityType model instance.

        :param  name: name of the ActivityType
        :type   name: str

        :param  version: version of the ActivityType
        :type   version: str

        :param  status: ActivityType status
        :type   status: swf.constants.{REGISTERED, DEPRECATED}

        :param  description: ActivityType description
        :type   description: str | None

        :param   creation_date: creation date of the current ActivityType
        :type    creation_date: float (timestamp)

        :param   deprecation_date: deprecation date of ActivityType
        :type    deprecation_date: float (timestamp)

        :param  task_list: specifies the default task list to use for scheduling
                           tasks of this activity type.
        :type   task_list: str

        :param  task_heartbeat_timeout: default maximum time before which a worker
                                        processing a task of this type must report
                                        progress by calling RecordActivityTaskHeartbeat.
        :type   task_heartbeat_timeout: int

        :param  task_schedule_to_close_timeout: default maximum duration for a task
                                                of this activity type.
        :type   task_schedule_to_close_timeout: int

        :param  task_schedule_to_start_timeout: default maximum duration that a
                                                task of this activity type can wait
                                                before being assigned to a worker.
        :type   task_schedule_to_start_timeout: int

        :param   task_start_to_close_timeout: default maximum duration that a
                                              worker can take to process tasks of
                                              this activity type.
        :type    task_start_to_close_timeout: int
        """
        activity_type = ActivityType(
            self.domain,
            name,
            version,
            status=status,
            description=description,
            creation_date=creation_date,
            deprecation_date=deprecation_date,
            task_list=task_list,
            task_heartbeat_timeout=task_heartbeat_timeout,
            task_schedule_to_close_timeout=task_schedule_to_close_timeout,
            task_schedule_to_start_timeout=task_schedule_to_start_timeout,
            task_start_to_close_timeout=task_start_to_close_timeout,
        )
        activity_type.save()

        return activity_type