From 47eb9f27b42654ec125a6c5d1c7aae9f3d2a253c Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Wed, 6 May 2020 12:30:02 -0700 Subject: [PATCH] Cleanup --- .efrocachemap | 24 +++++------ tools/staging_server_upkeep | 82 ------------------------------------- 2 files changed, 12 insertions(+), 94 deletions(-) delete mode 100755 tools/staging_server_upkeep diff --git a/.efrocachemap b/.efrocachemap index db8cd596..bfa7d835 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4132,16 +4132,16 @@ "assets/build/windows/x64/python.exe": "https://files.ballistica.net/cache/ba1/25/a7/dc87c1be41605eb6fefd0145144c", "assets/build/windows/x64/python37.dll": "https://files.ballistica.net/cache/ba1/b9/e4/d912f56e42e9991bcbb4c804cfcb", "assets/build/windows/x64/pythonw.exe": "https://files.ballistica.net/cache/ba1/6c/bb/b6f52c306aa4e88061510e96cefe", - "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8b/e2/8ab3f02c813d2e43df787d478023", - "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ca/46/ae21c3d6765f6625ac06b9215f3d", - "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/21/f2/079c550e8ba0e255c6255dc0737a", - "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/19/f3/1121125a99e5efb3577a491799e9", - "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/87/b1/4d076556aac39f44ccb03278f584", - "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/84/f6/607fd2ab859f610fdd91a9a857db", - "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/40/f3/00df4a55512b824534bda6945204", - "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f8/2f/09295de6690e6df09c0003b4d85b", - "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/61/62/2e8398b3dcf1ae702ba591aa947e", - "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/e1/db/1acefefb21e4fd0fe8e337647592", - "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ef/85/b8235ca82f2e3319850535558f0f", - "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/26/ba/1f40445d853e6be53beacd7a3ca3" + "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/59/62/0e5ac2b46a5438c44b71cbd481f3", + "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d5/a0/24450aa3a109f46b8de530f3542c", + "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/6b/c6/87e18650e0d915940872a4f0ebc5", + "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1e/4a/1d0da8d0daaa310d6c720e13b7f3", + "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/85/1d/53dd5b11be195af10836418f88ba", + "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ff/0d/6a44988894b902e945404cad30a3", + "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/76/39/00257d02256b64d5fcea94c990a6", + "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/11/8a/0dba7e2767e2e46a794d2292c22b", + "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/2b/c6/ac4ab426f624f1c9be3adb9142de", + "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/f9/24/6d644b6ba0f4805f973a93ba2306", + "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8b/ef/3f67c6eaa74ffae34c2b00fa9a2f", + "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/c3/82/945ef147612716d416ba2c132462" } \ No newline at end of file diff --git a/tools/staging_server_upkeep b/tools/staging_server_upkeep deleted file mode 100755 index 8ab000da..00000000 --- a/tools/staging_server_upkeep +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python3.7 -# Copyright (c) 2011-2020 Eric Froemling -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# ----------------------------------------------------------------------------- -"""Perform various tidying on the staging server.""" - -from __future__ import annotations - -import sys -import os -import subprocess -import stat -from pathlib import Path -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - pass - - -def run() -> None: - """Do the thing.""" - rootdir = 'files.ballistica.net/cache/ba1' - assert os.path.isdir(rootdir) - - # Just make a temp file to get 'now'. - # (ugly but effective) - tmppath = Path('_tmp_time_test') - tmppath.touch() - curtime = tmppath.stat()[stat.ST_ATIME] - tmppath.unlink() - - oldest_age = 0 - - for root, _dirnames, fnames in os.walk(rootdir): - for fname in fnames: - # print('doing', os.path.join(root, fname)) - fstat = os.stat(os.path.join(root, fname)) - accesstime = fstat[stat.ST_MTIME] - age = curtime - accesstime - oldest_age = max(oldest_age, age) - # print('was', (curtime - accesstime)/60, 'min') - # print('TEMP BREW') - # break - print('oldest is', oldest_age / 60 / 60 // 24, 'day') - - -def remote_run() -> None: - """Upload and execute ourself.""" - - print(f'Uploading {__file__}...') - subprocess.run(['rsync', __file__, 'ubuntu@ballistica.net:'], check=True) - - subprocess.run([ - 'ssh', 'ubuntu@ballistica.net', - './staging_server_upkeep -run && rm staging_server_upkeep' - ], - check=True) - print('SUCCESS') - - -if __name__ == '__main__': - if '-run' in sys.argv: - run() - else: - remote_run()