GJL commented on a change in pull request #10666: [FLINK-15214] Introduce multiple submission e2e test URL: https://github.com/apache/flink/pull/10666#discussion_r362766765
########## File path: flink-end-to-end-tests/test-scripts/test_mesos_multi_submission.sh ########## @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +################################################################################ +# 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. +################################################################################ + +set -o pipefail + +source "$(dirname "$0")"/common.sh +source "$(dirname "$0")"/common_mesos_docker.sh + +FIRST_DURATION=15 +SECOND_DURATION=5 +CPUS=$(lscpu | grep "^CPU(s):" | awk '{print $2}') +FIRST_OUTPUT_LOCATION="${TEST_DATA_DIR}/out/first_out" +SECOND_OUTPUT_LOCATION="${TEST_DATA_DIR}/out/second_out" +TEST_PROGRAM_JAR=$END_TO_END_DIR/flink-cli-test/target/PeriodicStreamingJob.jar +if [[ "$OSTYPE" == "linux-gnu" ]]; then + CPUS=$(lscpu | grep "^CPU(s):" | awk '{print $2}') +elif [[ "$OSTYPE" == "darwin"* ]]; then + CPUS=$(sysctl -n hw.ncpu) +else + echo "Could not verify the OS type." + exit 1 +fi + + +mkdir -p "${TEST_DATA_DIR}" + +# There should be only one TaskManager with one slot; Thus, there are not enough resources to allocate a complete new set of slots for the second job. +# To ensure the old slots are being reused. +set_config_key "mesos.resourcemanager.tasks.cpus" "${CPUS}" + +start_flink_cluster_with_mesos + +JOB1_ID=$(docker exec -it mesos-master bash -c "${FLINK_DIR}/bin/flink run -d -p 1 ${TEST_PROGRAM_JAR} --durationInSecond ${FIRST_DURATION} --outputPath ${FIRST_OUTPUT_LOCATION}" \ + | grep "Job has been submitted with JobID" | sed 's/.* //g' | tr -d '\r') + +wait_num_of_occurence_in_logs_mesos "switched from DEPLOYING to RUNNING" 1 Review comment: I don't think the implementation is fragile. However, the concept of grepping logs is fragile because log messages are not part of the public API. Changing the log message or the log level [1] can break this test. Moreover, we would likely discover the breaking test very late because E2E tests are expensive to run, and only a subset of all tests are run on a pre-commit basis. If there is only a single slot in the entire cluster, one of the jobs will always have to wait for the other to complete. What difference does it make to deploy the second job later? Please correct me if I am missing something. [1] https://github.com/apache/flink/blob/552a07677470d2df620aeb4e681e829f31d1526f/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java#L1528 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
