Debian Codegraph @

tools/run_tests/performance/remote_host_prepare.sh

raw
1 #!/bin/bash
2 # Copyright 2015 gRPC authors.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 set -ex
17
18 cd "$(dirname "$0")/../../.."
19
20 # TODO(jtattermusch): To be sure there are no running processes that would
21 # mess with the results, be rough and reboot the worker here
22 # and wait for it to come back online.
23 ssh "${USER_AT_HOST}" "killall -9 qps_worker dotnet mono node ruby worker || true"
24
25 # On Windows, killall is not supported & we need to kill all pending workers
26 # before attempting to delete the workspace
27 ssh "${USER_AT_HOST}" "ps -e | egrep 'qps_worker|dotnet' | awk '{print \$1}' | xargs kill -9 || true"
28
29 # cleanup after previous builds
30 ssh "${USER_AT_HOST}" "rm -rf ~/performance_workspace && mkdir -p ~/performance_workspace"
31
32 # push the current sources to the worker and unpack it.
33 scp ../grpc.tar "${USER_AT_HOST}:~/performance_workspace"
34 # Windows workaround: attempt to untar twice, first run is going to fail
35 # with symlink creation error(s).
36 ssh "${USER_AT_HOST}" "tar -xf ~/performance_workspace/grpc.tar -C ~/performance_workspace || tar -xf ~/performance_workspace/grpc.tar -C ~/performance_workspace"
37
38 # For consistency with local run, invoke the kill_workers script remotely.
39 # shellcheck disable=SC2088
40 ssh "${USER_AT_HOST}" "~/performance_workspace/grpc/tools/run_tests/performance/kill_workers.sh"
41
42 # make sure the port server is running (required by C++ qps_worker)
43 ssh "${USER_AT_HOST}" "cd ~/performance_workspace/grpc/ && python tools/run_tests/start_port_server.py"