| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| """ |
| Launch the topology as a single aurora job with multiple instances. |
| The heron-executor is responsible for starting a tmaster (container 0) |
| and regular stmgr/metricsmgr/instances (container index > 0). |
| """ |
| |
| heron_core_release_uri = '{{CORE_PACKAGE_URI}}' |
| heron_topology_jar_uri = '{{TOPOLOGY_PACKAGE_URI}}' |
| core_release_file = "heron-core.tar.gz" |
| topology_package_file = "topology.tar.gz" |
| |
| # --- processes --- |
| fetch_heron_system = Process( |
| name = 'fetch_heron_system', |
| cmdline = 'curl %s -o %s && tar zxf %s' % (heron_core_release_uri, core_release_file, core_release_file) |
| ) |
| |
| fetch_user_package = Process( |
| name = 'fetch_user_package', |
| cmdline = 'curl %s -o %s && tar zxf %s' % (heron_topology_jar_uri, topology_package_file, topology_package_file) |
| ) |
| |
| command_to_start_executor = \ |
| '{{EXECUTOR_BINARY}}' \ |
| ' --shard={{mesos.instance}}' \ |
| ' --master-port={{thermos.ports[port1]}}' \ |
| ' --tmaster-controller-port={{thermos.ports[port2]}}' \ |
| ' --tmaster-stats-port={{thermos.ports[port3]}}' \ |
| ' --shell-port={{thermos.ports[http]}}' \ |
| ' --metrics-manager-port={{thermos.ports[port4]}}' \ |
| ' --scheduler-port={{thermos.ports[scheduler]}}' \ |
| ' --metricscache-manager-master-port={{thermos.ports[metricscachemgr_masterport]}}' \ |
| ' --metricscache-manager-stats-port={{thermos.ports[metricscachemgr_statsport]}}' \ |
| ' --checkpoint-manager-port={{thermos.ports[ckptmgr_port]}}' \ |
| ' {{TOPOLOGY_ARGUMENTS}}' |
| |
| launch_heron_executor = Process( |
| name = 'launch_heron_executor', |
| cmdline = command_to_start_executor, |
| max_failures = 1 |
| ) |
| |
| discover_profiler_port = Process( |
| name = 'discover_profiler_port', |
| cmdline = 'echo {{thermos.ports[yourkit]}} > yourkit.port' |
| ) |
| |
| # --- tasks --- |
| heron_task = SequentialTask( |
| name = 'setup_and_run', |
| processes = [fetch_heron_system, fetch_user_package, launch_heron_executor, discover_profiler_port], |
| resources = Resources(cpu = '{{CPUS_PER_CONTAINER}}', ram = '{{RAM_PER_CONTAINER}}', disk = '{{DISK_PER_CONTAINER}}') |
| ) |
| |
| # -- jobs --- |
| jobs = [ |
| Job( |
| name = '{{TOPOLOGY_NAME}}', |
| cluster = '{{CLUSTER}}', |
| role = '{{ROLE}}', |
| environment = '{{ENVIRON}}', |
| service = True, |
| task = heron_task, |
| instances = '{{NUM_CONTAINERS}}', |
| announce = Announcer(primary_port = 'http', portmap = {'health': 'http'}), |
| health_check_config = HealthCheckConfig( |
| health_checker = HealthCheckerConfig( |
| http = HttpHealthChecker(endpoint='/health', expected_response='ok', expected_response_code=200) |
| ), |
| initial_interval_secs=30, |
| interval_secs=10, |
| max_consecutive_failures=2, |
| timeout_secs=5 |
| ) |
| ) |
| ] |