remote_host_prepare.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. set -ex
  16. cd "$(dirname "$0")/../../.."
  17. # TODO(jtattermusch): To be sure there are no running processes that would
  18. # mess with the results, be rough and reboot the worker here
  19. # and wait for it to come back online.
  20. ssh "${USER_AT_HOST}" "killall -9 qps_worker dotnet mono node ruby worker || true"
  21. # On Windows, killall is not supported & we need to kill all pending workers
  22. # before attempting to delete the workspace
  23. ssh "${USER_AT_HOST}" "ps -e | egrep 'qps_worker|dotnet' | awk '{print \$1}' | xargs kill -9 || true"
  24. # cleanup after previous builds
  25. ssh "${USER_AT_HOST}" "rm -rf ~/performance_workspace && mkdir -p ~/performance_workspace"
  26. # push the current sources to the worker and unpack it.
  27. scp ../grpc.tar "${USER_AT_HOST}:~/performance_workspace"
  28. # Windows workaround: attempt to untar twice, first run is going to fail
  29. # with symlink creation error(s).
  30. ssh "${USER_AT_HOST}" "tar -xf ~/performance_workspace/grpc.tar -C ~/performance_workspace || tar -xf ~/performance_workspace/grpc.tar -C ~/performance_workspace"
  31. # For consistency with local run, invoke the kill_workers script remotely.
  32. # shellcheck disable=SC2088
  33. ssh "${USER_AT_HOST}" "~/performance_workspace/grpc/tools/run_tests/performance/kill_workers.sh"
  34. # make sure the port server is running (required by C++ qps_worker)
  35. ssh "${USER_AT_HOST}" "cd ~/performance_workspace/grpc/ && python tools/run_tests/start_port_server.py"