当前位置: 首页>>代码示例>>Python>>正文


Python AbstractLatentWorker.__init__方法代码示例

本文整理汇总了Python中buildbot.worker.AbstractLatentWorker.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python AbstractLatentWorker.__init__方法的具体用法?Python AbstractLatentWorker.__init__怎么用?Python AbstractLatentWorker.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在buildbot.worker.AbstractLatentWorker的用法示例。


在下文中一共展示了AbstractLatentWorker.__init__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from buildbot.worker import AbstractLatentWorker [as 别名]
# 或者: from buildbot.worker.AbstractLatentWorker import __init__ [as 别名]
    def __init__(
        self,
        name,
        password,
        docker_host,
        image=None,
        command=None,
        volumes=None,
        dockerfile=None,
        version=None,
        tls=None,
        followStartupLogs=False,
        masterFQDN=None,
        hostconfig=None,
        networking_config="bridge",
        **kwargs
    ):

        if not client:
            config.error("The python module 'docker-py>=1.4' is needed to use a" " DockerLatentWorker")
        if not image and not dockerfile:
            config.error("DockerLatentWorker: You need to specify at least" " an image name, or a dockerfile")

        self.volumes = volumes or []
        self.binds = {}
        self.networking_config = networking_config
        self.followStartupLogs = followStartupLogs

        # Following block is only for checking config errors,
        # actual parsing happens in self.parse_volumes()
        # Renderables can be direct volumes definition or list member
        if isinstance(volumes, list):
            for volume_string in volumes or []:
                if not isinstance(volume_string, str):
                    continue
                try:
                    volume, bind = volume_string.split(":", 1)
                except ValueError:
                    config.error("Invalid volume definition for docker " "%s. Skipping..." % volume_string)
                    continue

        # Set build_wait_timeout to 0 if not explicitely set: Starting a
        # container is almost immediate, we can affort doing so for each build.
        if "build_wait_timeout" not in kwargs:
            kwargs["build_wait_timeout"] = 0
        AbstractLatentWorker.__init__(self, name, password, **kwargs)

        self.image = image
        self.command = command or []
        self.dockerfile = dockerfile
        if masterFQDN is None:
            masterFQDN = socket.getfqdn()
        self.masterFQDN = masterFQDN
        self.hostconfig = hostconfig or {}
        # Prepare the parameters for the Docker Client object.
        self.client_args = {"base_url": docker_host}
        if version is not None:
            self.client_args["version"] = version
        if tls is not None:
            self.client_args["tls"] = tls
开发者ID:stefanseefeld,项目名称:buildbot,代码行数:62,代码来源:docker.py

示例2: __init__

# 需要导入模块: from buildbot.worker import AbstractLatentWorker [as 别名]
# 或者: from buildbot.worker.AbstractLatentWorker import __init__ [as 别名]
    def __init__(self, name, password,
                 flavor,
                 os_username,
                 os_password,
                 os_tenant_name,
                 os_auth_url,
                 os_user_domain=None,
                 os_project_domain=None,
                 block_devices=None,
                 region=None,
                 image=None,
                 meta=None,
                 # Have a nova_args parameter to allow passing things directly
                 # to novaclient.
                 nova_args=None,
                 client_version='2',
                 **kwargs):

        if not client:
            config.error("The python module 'novaclient' is needed  "
                         "to use a OpenStackLatentWorker. "
                         "Please install 'python-novaclient' package.")
        if not loading or not session:
            config.error("The python module 'keystoneauth1' is needed "
                         "to use a OpenStackLatentWorker. "
                         "Please install the 'keystoneauth1' package.")

        if not block_devices and not image:
            raise ValueError('One of block_devices or image must be given')

        AbstractLatentWorker.__init__(self, name, password, **kwargs)

        self.flavor = flavor
        self.client_version = client_version
        if client:
            self.novaclient = self._constructClient(
                client_version, os_username, os_user_domain, os_password, os_tenant_name, os_project_domain,
                os_auth_url)
            if region is not None:
                self.novaclient.client.region_name = region

        if block_devices is not None:
            self.block_devices = [
                self._parseBlockDevice(bd) for bd in block_devices]
        else:
            self.block_devices = None
        self.image = image
        self.meta = meta
        self.nova_args = nova_args if nova_args is not None else {}
开发者ID:Cray,项目名称:buildbot,代码行数:51,代码来源:openstack.py

示例3: __init__

# 需要导入模块: from buildbot.worker import AbstractLatentWorker [as 别名]
# 或者: from buildbot.worker.AbstractLatentWorker import __init__ [as 别名]
    def __init__(self, name, password, docker_host, image=None, command=None,
                 volumes=None, dockerfile=None, version=None, tls=None, followStartupLogs=False,
                 masterFQDN=None, hostconfig=None, networking_config='bridge', **kwargs):

        if not client:
            config.error("The python module 'docker-py>=1.4' is needed to use a"
                         " DockerLatentWorker")
        if not image and not dockerfile:
            config.error("DockerLatentWorker: You need to specify at least"
                         " an image name, or a dockerfile")

        self.volumes = []
        self.binds = {}
        self.networking_config = networking_config
        self.followStartupLogs = followStartupLogs
        for volume_string in (volumes or []):
            try:
                volume, bind = volume_string.split(":", 1)
            except ValueError:
                config.error("Invalid volume definition for docker "
                             "%s. Skipping..." % volume_string)
                continue
            self.volumes.append(volume)

            ro = False
            if bind.endswith(':ro') or bind.endswith(':rw'):
                ro = bind[-2:] == 'ro'
                bind = bind[:-3]
            self.binds[volume] = {'bind': bind, 'ro': ro}

        # Set build_wait_timeout to 0 if not explicitely set: Starting a
        # container is almost immediate, we can affort doing so for each build.
        if 'build_wait_timeout' not in kwargs:
            kwargs['build_wait_timeout'] = 0
        AbstractLatentWorker.__init__(self, name, password, **kwargs)

        self.image = image
        self.command = command or []
        self.dockerfile = dockerfile
        if masterFQDN is None:
            masterFQDN = socket.getfqdn()
        self.masterFQDN = masterFQDN
        self.hostconfig = hostconfig or {}
        # Prepare the parameters for the Docker Client object.
        self.client_args = {'base_url': docker_host}
        if version is not None:
            self.client_args['version'] = version
        if tls is not None:
            self.client_args['tls'] = tls
开发者ID:Rjaylyn,项目名称:buildbot,代码行数:51,代码来源:docker.py

示例4: __init__

# 需要导入模块: from buildbot.worker import AbstractLatentWorker [as 别名]
# 或者: from buildbot.worker.AbstractLatentWorker import __init__ [as 别名]
    def __init__(self, name, password, connection, hd_image, base_image=None, xml=None,
                 **kwargs):
        AbstractLatentWorker.__init__(self, name, password, **kwargs)
        if not libvirt:
            config.error(
                "The python module 'libvirt' is needed to use a LibVirtWorker")

        self.connection = connection
        self.image = hd_image
        self.base_image = base_image
        self.xml = xml

        self.cheap_copy = True
        self.graceful_shutdown = False

        self.domain = None

        self.ready = False
        self._find_existing_deferred = self._find_existing_instance()
开发者ID:Cray,项目名称:buildbot,代码行数:21,代码来源:libvirt.py

示例5: __init__

# 需要导入模块: from buildbot.worker import AbstractLatentWorker [as 别名]
# 或者: from buildbot.worker.AbstractLatentWorker import __init__ [as 别名]
    def __init__(self, name, password, instance_type, ami=None,
                 valid_ami_owners=None, valid_ami_location_regex=None,
                 elastic_ip=None, identifier=None, secret_identifier=None,
                 aws_id_file_path=None, user_data=None, region=None,
                 keypair_name=None,
                 security_name=None,
                 spot_instance=False, max_spot_price=1.6, volumes=None,
                 placement=None, price_multiplier=1.2, tags=None,
                 product_description='Linux/UNIX',
                 subnet_id=None, security_group_ids=None, instance_profile_name=None,
                 block_device_map=None, session=None,
                 **kwargs):

        if not boto3:
            config.error("The python module 'boto3' is needed to use a "
                         "EC2LatentWorker")

        if keypair_name is None:
            reportDeprecatedWorkerNameUsage(
                "Use of default value of 'keypair_name' of EC2LatentWorker "
                "constructor is deprecated. Please explicitly specify value")
            keypair_name = 'latent_buildbot_slave'
        if security_name is None and not subnet_id:
            reportDeprecatedWorkerNameUsage(
                "Use of default value of 'security_name' of EC2LatentWorker "
                "constructor is deprecated. Please explicitly specify value")
            security_name = 'latent_buildbot_slave'

        if volumes is None:
            volumes = []

        if tags is None:
            tags = {}

        AbstractLatentWorker.__init__(self, name, password, **kwargs)

        if security_name and subnet_id:
            raise ValueError(
                'security_name (EC2 classic security groups) is not supported '
                'in a VPC.  Use security_group_ids instead.')
        if not ((ami is not None) ^
                (valid_ami_owners is not None or
                 valid_ami_location_regex is not None)):
            raise ValueError(
                'You must provide either a specific ami, or one or both of '
                'valid_ami_location_regex and valid_ami_owners')
        self.ami = ami
        if valid_ami_owners is not None:
            if isinstance(valid_ami_owners, integer_types):
                valid_ami_owners = (valid_ami_owners,)
            else:
                for element in valid_ami_owners:
                    if not isinstance(element, integer_types):
                        raise ValueError(
                            'valid_ami_owners should be int or iterable '
                            'of ints', element)
        if valid_ami_location_regex is not None:
            if not isinstance(valid_ami_location_regex, string_types):
                raise ValueError(
                    'valid_ami_location_regex should be a string')
            else:
                # verify that regex will compile
                re.compile(valid_ami_location_regex)
        if spot_instance and price_multiplier is None and max_spot_price is None:
            raise ValueError('You must provide either one, or both, of '
                             'price_multiplier or max_spot_price')
        self.valid_ami_owners = None
        if valid_ami_owners:
            self.valid_ami_owners = [str(o) for o in valid_ami_owners]
        self.valid_ami_location_regex = valid_ami_location_regex
        self.instance_type = instance_type
        self.keypair_name = keypair_name
        self.security_name = security_name
        self.user_data = user_data
        self.spot_instance = spot_instance
        self.max_spot_price = max_spot_price
        self.volumes = volumes
        self.price_multiplier = price_multiplier
        self.product_description = product_description

        if None not in [placement, region]:
            self.placement = '%s%s' % (region, placement)
        else:
            self.placement = None
        if identifier is None:
            assert secret_identifier is None, (
                'supply both or neither of identifier, secret_identifier')
            if aws_id_file_path is None:
                home = os.environ['HOME']
                default_path = os.path.join(home, '.ec2', 'aws_id')
                if os.path.exists(default_path):
                    aws_id_file_path = default_path
            if aws_id_file_path:
                log.msg('WARNING: EC2LatentWorker is using deprecated '
                        'aws_id file')
                with open(aws_id_file_path, 'r') as aws_file:
                    identifier = aws_file.readline().strip()
                    secret_identifier = aws_file.readline().strip()
        else:
            assert aws_id_file_path is None, \
#.........这里部分代码省略.........
开发者ID:Cray,项目名称:buildbot,代码行数:103,代码来源:ec2.py

示例6: __init__

# 需要导入模块: from buildbot.worker import AbstractLatentWorker [as 别名]
# 或者: from buildbot.worker.AbstractLatentWorker import __init__ [as 别名]
 def __init__(self, name, controller, **kwargs):
     self._controller = controller
     AbstractLatentWorker.__init__(self, name, None, **kwargs)
开发者ID:buildbot,项目名称:buildbot,代码行数:5,代码来源:latent.py


注:本文中的buildbot.worker.AbstractLatentWorker.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。