Skip to content
Snippets Groups Projects
Commit 1057c170 authored by Andrew Kapuscinski's avatar Andrew Kapuscinski
Browse files

Added work in pex watcher to check for missing pexes from local sbin area

parent 07f9ceb3
No related branches found
No related tags found
1 merge request!706Added work in pex watcher to check for missing pexes from local sbin area
Pipeline #3908 passed
......@@ -28,10 +28,11 @@ BUILD_DIR=/lustre/aoc/cluster/pipeline/docker/workspaces/sbin
cd apps/cli/executables/pexable/
for pexable in "$@"
do
if [ $pexable == "ingest" ]; then
echo "Skipping $pexable"
continue
fi
# Uncomment lines below to skip ingest pex build
# if [ $pexable == "ingest" ]; then
# echo "Skipping $pexable"
# continue
# fi
cd "$pexable"
if [ -e setup.py ]; then
pex_build_cmd="python3 setup.py bdist_pex --bdist-all --bdist-dir=\"$BUILD_DIR\" --pex-args=\"--python-shebang /home/ssa/bin/python3.8\""
......
......@@ -17,6 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
import os
import re
import subprocess
import sys
......@@ -63,11 +64,39 @@ class PexHandler(FileSystemEventHandler):
print("Modification event handled.")
def build_missing_pexes(path_to_sbin, path_to_pexables):
sbin_content = os.listdir(path_to_sbin)
pexables = os.listdir(path_to_pexables)
existing_pexes_in_sbin = set(sbin_content).intersection(set(pexables))
if len(pexables) > len(existing_pexes_in_sbin):
missing_pexables = set(pexables).difference(existing_pexes_in_sbin)
print(
f"There {'is' if len(missing_pexables) == 1 else 'are'} "
f"{len(missing_pexables)} pex{'' if len(missing_pexables) == 1 else 'es'} "
f"missing from your sbin area: \n{missing_pexables}"
)
for pex in missing_pexables:
print(f"Building {pex}")
sp = subprocess.run(
["./bin/local-build-pexables.sh", f"{pex}"],
stdout=subprocess.PIPE,
universal_newlines=True,
)
print(f"{sp.stdout}")
else:
print("There are no missing pexes.")
if __name__ == "__main__":
path = sys.argv[1] if len(sys.argv) > 1 else "./apps/cli/executables/pexable/"
path_to_sbin = "/lustre/aoc/cluster/pipeline/docker/workspaces/sbin"
path_to_pexables = sys.argv[1] if len(sys.argv) > 1 else "./apps/cli/executables/pexable/"
build_missing_pexes(path_to_sbin, path_to_pexables)
print("Starting Pex Watcher...")
event_handler = PexHandler()
observer = Observer()
observer.schedule(event_handler, path, recursive=True)
observer.schedule(event_handler, path_to_pexables, recursive=True)
observer.start()
try:
while True:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment