How to use the sfctl.custom_health.parse_service_health_policy function in sfctl

To help you get started, we’ve selected a few sfctl 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 microsoft / service-fabric-cli / src / sfctl / custom_compose.py View on Github external
def create_app_health_policy(
        warning_as_error, unhealthy_app, default_svc_health_map,
        svc_type_health_map):
    """Create an application health policy description"""
    from sfctl.custom_health import (parse_service_health_policy,
                                     parse_service_health_policy_map)
    from azure.servicefabric.models import ApplicationHealthPolicy

    default_svc_type_policy = parse_service_health_policy(
        default_svc_health_map
    )
    svc_type_policy = parse_service_health_policy_map(svc_type_health_map)

    return ApplicationHealthPolicy(
        consider_warning_as_error=warning_as_error,
        max_percent_unhealthy_deployed_applications=unhealthy_app,
        default_service_type_health_policy=default_svc_type_policy,
        service_type_health_policy_map=svc_type_policy
    )
github microsoft / service-fabric-cli / src / sfctl / custom_app.py View on Github external
monitoring_policy = MonitoringPolicyDescription(
        failure_action=failure_action,
        health_check_wait_duration_in_milliseconds=health_check_wait_duration,
        health_check_stable_duration_in_milliseconds=health_check_stable_duration,
        health_check_retry_timeout_in_milliseconds=health_check_retry_timeout,
        upgrade_timeout_in_milliseconds=upgrade_timeout,
        upgrade_domain_timeout_in_milliseconds=upgrade_domain_timeout
    )

    # Must always have empty list
    app_params = parse_app_params(parameters)
    if app_params is None:
        app_params = []

    def_shp = parse_service_health_policy(default_service_health_policy)

    map_shp = parse_service_health_policy_map(service_health_policy)

    app_health_policy = ApplicationHealthPolicy(
        consider_warning_as_error=warning_as_error,
        max_percent_unhealthy_deployed_applications=max_unhealthy_apps,
        default_service_type_health_policy=def_shp,
        service_type_health_policy_map=map_shp)

    desc = ApplicationUpgradeDescription(
        name='fabric:/' + application_id,
        target_application_type_version=application_version,
        parameters=app_params,
        upgrade_kind='Rolling',
        rolling_upgrade_mode=mode,
        upgrade_replica_set_check_timeout_in_seconds=replica_set_check_timeout,