activities.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:heaviside 作者: jhuapl-boss 项目源码 文件源码
def __init__(self, name, arn=None, worker=None, **kwargs):
        """
        Args:
            name (String): Name of the Activity to monitor
            arn (String): Full ARN of Activity to monitor
                          If not given, it is looked up
                          If given, the actual ARN and Name are compared
            process (callable): Callable that transforms the task's input
                                into an output that is then returned
            kwargs : Arguments to heaviside.utils.create_session
        """
        self.name = name
        self.arn = arn
        self.worker = worker
        self.token = None

        self.session, self.account_id = create_session(**kwargs)
        self.client = self.session.client('stepfunctions', config=Config(read_timeout=70))
        self.log = logging.getLogger(__name__)

        self.max_concurrent = 0
        self.poll_delay = 1

        if self.arn is None:
            self.arn = self.lookup_activity_arn(name)
        else:
            try:
                resp = self.client.describe_activity(activityArn = self.arn)
                if resp['name'] != name:
                    raise Exception("Name of {} is not {}".format(self.arn, self.name))
            except ClientError:
                raise Exception("ARN {} is not valid".format(self.arn))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号