How to use heat - 10 common examples

To help you get started, we’ve selected a few heat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github helmholtz-analytics / heat / heat / core / linalg / basics.py View on Github external
del b_lp_data[pr - 1]

            if pr == b.comm.size - 1:
                req[pr].wait()
                st0 = index_map[pr, 0, 0, 0].item()
                sp0 = index_map[pr, 0, 0, 1].item() + 1
                st1 = index_map[pr, 1, 1, 0].item()
                sp1 = index_map[pr, 1, 1, 1].item()
                c._DNDarray__array[: sp0 - st0, st1:sp1] += a._DNDarray__array @ b_lp_data[pr]

                del b_lp_data[pr]

        c = (
            c
            if not vector_flag
            else factories.array(c._DNDarray__array.squeeze(), is_split=0, device=a.device)
        )
        return c

    elif split_10_flag:
        # for this case, only a sum is needed at the end
        a_rem_locs1 = (rem_map[:, 0, 1] == 1).nonzero()
        # locations of the remainders in b
        b_rem_locs0 = (rem_map[:, 1, 0] == 1).nonzero()
        res = torch.zeros(
            (a.gshape[-2], b.gshape[1]), dtype=c_type.torch_type(), device=c.device.torch_device
        )
        for i in range(a.lshape[-1] // kB):
            res += (
                a._DNDarray__array[:mB, i * kB : i * kB + kB]
                @ b._DNDarray__array[i * kB : i * kB + kB, :nB]
            )
github openstack / heat / heat / engine / resources / openstack / heat / test_resource.py View on Github external
default='',
            update_allowed=True
        ),
        ENTITY_NAME: properties.Schema(
            properties.Schema.STRING,
            _('Client entity to poll.'),
            default='',
            update_allowed=True
        ),
    }

    attributes_schema = {
        OUTPUT: attributes.Schema(
            _('The string that was stored. This value is '
              'also available by referencing the resource.'),
            cache_mode=attributes.Schema.CACHE_NONE
        ),
    }

    def _wait_secs(self):
        secs = None
        if self.properties[self.ACTION_WAIT_SECS]:
            secs = self.properties[self.ACTION_WAIT_SECS][self.action.lower()]
        if secs is None:
            secs = self.properties[self.WAIT_SECS]
        LOG.info('%(name)s wait_secs:%(wait)s, action:%(action)s',
                 {'name': self.name,
                  'wait': secs,
                  'action': self.action.lower()})
        return secs

    def handle_create(self):
github openstack / heat / heat / engine / resources / openstack / heat / test_resource.py View on Github external
UPDATE_WAIT_SECS: properties.Schema(
                    properties.Schema.NUMBER,
                    _('Seconds to wait after an update. '
                      'Defaults to the global wait_secs'),
                    update_allowed=True,
                ),
                DELETE_WAIT_SECS: properties.Schema(
                    properties.Schema.NUMBER,
                    _('Seconds to wait after a delete. '
                      'Defaults to the global wait_secs'),
                    update_allowed=True,
                ),
            }
        ),
        CLIENT_NAME: properties.Schema(
            properties.Schema.STRING,
            _('Client to poll.'),
            default='',
            update_allowed=True
        ),
        ENTITY_NAME: properties.Schema(
            properties.Schema.STRING,
            _('Client entity to poll.'),
            default='',
            update_allowed=True
        ),
    }

    attributes_schema = {
        OUTPUT: attributes.Schema(
            _('The string that was stored. This value is '
              'also available by referencing the resource.'),
github openstack / heat / heat / engine / resources / openstack / zaqar / subscription.py View on Github external
def _validate_subscriber(self):
        subscriber_type = self.properties[self.SUBSCRIBER].split(":", 1)[0]
        if subscriber_type not in self.VALID_SUBSCRIBER_TYPES:
            msg = (_("The subscriber type of must be one of: %s.")
                   % ", ".join(self.VALID_SUBSCRIBER_TYPES))
            raise exception.StackValidationFailed(message=msg)
github openstack / heat / heat / common / client.py View on Github external
"and you have supplied a key, "
                        "however you have failed to supply either a "
                        "cert_file parameter or set the "
                        "HEAT_CLIENT_CERT_FILE environ variable")
                raise exception.ClientConnectionError(msg)

            if (self.key_file is not None and
                    not os.path.exists(self.key_file)):
                msg = _("The key file you specified %s does not "
                        "exist") % self.key_file
                raise exception.ClientConnectionError(msg)
            connect_kwargs['key_file'] = self.key_file

            if (self.cert_file is not None and
                    not os.path.exists(self.cert_file)):
                msg = _("The cert file you specified %s does not "
                        "exist") % self.cert_file
                raise exception.ClientConnectionError(msg)
            connect_kwargs['cert_file'] = self.cert_file

            if (self.ca_file is not None and
                    not os.path.exists(self.ca_file)):
                msg = _("The CA file you specified %s does not "
                        "exist") % self.ca_file
                raise exception.ClientConnectionError(msg)

            if self.ca_file is None:
                for ca in self.DEFAULT_CA_FILE_PATH.split(":"):
                    if os.path.exists(ca):
                        self.ca_file = ca
                        break
github openstack / heat / heat / engine / resources / openstack / zun / container.py View on Github external
MEMORY: properties.Schema(
            properties.Schema.INTEGER,
            _('The container memory size in MiB.'),
            update_allowed=True
        ),
        ENVIRONMENT: properties.Schema(
            properties.Schema.MAP,
            _('The environment variables.'),
        ),
        WORKDIR: properties.Schema(
            properties.Schema.STRING,
            _('The working directory for commands to run in.'),
        ),
        LABELS: properties.Schema(
            properties.Schema.MAP,
            _('Adds a map of labels to a container. '
              'May be used multiple times.'),
        ),
        IMAGE_PULL_POLICY: properties.Schema(
            properties.Schema.STRING,
            _('The policy which determines if the image should '
              'be pulled prior to starting the container.'),
            constraints=[
                constraints.AllowedValues(['ifnotpresent', 'always',
                                           'never']),
            ]
        ),
        RESTART_POLICY: properties.Schema(
            properties.Schema.STRING,
            _('Restart policy to apply when a container exits. Possible '
              'values are "no", "on-failure[:max-retry]", "always", and '
              '"unless-stopped".'),
github openstack / heat / heat / engine / resources / volume.py View on Github external
constraints=[
                constraints.CustomConstraint('cinder.snapshot')
            ]
        ),
        BACKUP_ID: properties.Schema(
            properties.Schema.STRING,
            _('If specified, the backup to create the volume from.')
        ),
        NAME: properties.Schema(
            properties.Schema.STRING,
            _('A name used to distinguish the volume.'),
            update_allowed=True,
        ),
        DESCRIPTION: properties.Schema(
            properties.Schema.STRING,
            _('A description of the volume.'),
            update_allowed=True,
        ),
        VOLUME_TYPE: properties.Schema(
            properties.Schema.STRING,
            _('If specified, the type of volume to use, mapping to a '
              'specific backend.')
        ),
        METADATA: properties.Schema(
            properties.Schema.MAP,
            _('Key/value pairs to associate with the volume.'),
            update_allowed=True,
        ),
        IMAGE_REF: properties.Schema(
            properties.Schema.STRING,
            _('The ID of the image to create the volume from.'),
            support_status=support.SupportStatus(
github openstack / heat / heat / engine / clients / os / senlin.py View on Github external
def validate_with_client(self, client, value):
        senlin_client = client.client(CLIENT_NAME)
        type_list = senlin_client.profile_types()
        names = [pt.name for pt in type_list]
        if value not in names:
            not_found_message = (
                _("Unable to find senlin profile type '%(pt)s', "
                  "available profile types are %(pts)s.") %
                {'pt': value, 'pts': names}
            )
            raise exception.StackValidationFailed(message=not_found_message)
github Juniper / contrail-heat / contrail_heat / resources / service_health_check.py View on Github external
class HeatServiceHealthCheck(contrail.ContrailResource):
    PROPERTIES = (
        NAME, SERVICE_INSTANCE, SERVICE_PORT_TAG, MONITOR_TYPE,
        DELAY, TIMEOUT, MAX_RETRIES, HTTP_METHOD, URL_PATH,
        EXPECTED_CODES, ENABLED
    ) = (
        'name', 'service_instance', 'service_port_tag', 'monitor_type',
        'delay', 'timeout', 'max_retries', 'http_method', 'url_path',
        'expected_codes', 'enabled'
    )

    properties_schema = {
        NAME: properties.Schema(
            properties.Schema.STRING,
            _('Service health check name.'),
            required=True,
            update_allowed=False
        ),
        SERVICE_INSTANCE: properties.Schema(
            properties.Schema.STRING,
            _('Service instance name.'),
            required=True,
            update_allowed=False
        ),
        SERVICE_PORT_TAG: properties.Schema(
            properties.Schema.STRING,
            _('Service port tag.'),
            required=True,
            update_allowed=False
        ),
        MONITOR_TYPE: properties.Schema(
github openstack / heat / heat / engine / resources / openstack / keystone / role.py View on Github external
message=_('Supported versions: keystone v3'))

    default_client_name = 'keystone'

    entity = 'roles'

    PROPERTIES = (
        NAME, DOMAIN,
    ) = (
        'name', 'domain',
    )

    properties_schema = {
        NAME: properties.Schema(
            properties.Schema.STRING,
            _('Name of keystone role.'),
            update_allowed=True
        ),
        DOMAIN: properties.Schema(
            properties.Schema.STRING,
            _('Name or id of keystone domain.'),
            default='default',
            constraints=[constraints.CustomConstraint('keystone.domain')],
            support_status=support.SupportStatus(version='10.0.0')
        )
    }

    def translation_rules(self, properties):
        return [
            translation.TranslationRule(
                properties,
                translation.TranslationRule.RESOLVE,