Skip to content

Commit

Permalink
more update.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Jan 12, 2025
1 parent 506a50f commit c8325e8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 0 additions & 2 deletions pioreactor/cli/pios.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ def sync_config_files(unit: str, shared: bool, specific: bool) -> None:
try:
localpath = f"/home/pioreactor/.pioreactor/config_{unit}.ini"
remotepath = "/home/pioreactor/.pioreactor/unit_config.ini"
print(unit, localpath, remotepath)
cp_file_across_cluster(unit, localpath, remotepath, timeout=30)

except Exception as e:
Expand Down Expand Up @@ -571,7 +570,6 @@ def _thread_function(unit: str) -> bool:
logger.debug(f"Syncing configs on {unit}...")
try:
sync_config_files(unit, shared, specific)
logger.debug(f"worked for {unit}?")
return True
except RsyncError as e:
logger.warning(f"Could not transfer config to {unit}. Is it online?")
Expand Down
1 change: 0 additions & 1 deletion pioreactor/mureq.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ def _prepare_request(

"""Parses the URL, returns the path and the right HTTPConnection subclass."""
parsed_url = urllib.parse.urlparse(url)

is_unix = unix_socket is not None
scheme = parsed_url.scheme.lower()
if scheme.endswith("+unix"):
Expand Down
7 changes: 1 addition & 6 deletions pioreactor/utils/networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@


def rsync(*args: str) -> None:
from pioreactor.logging import create_logger

l = create_logger("rsync")
try:
l.info("rsync" + " " + " ".join(args))
r = subprocess.run(("rsync",) + args, check=True)
l.info(r)
assert r.returncode == 0
except subprocess.CalledProcessError as e:
raise RsyncError from e

Expand All @@ -28,7 +24,6 @@ def cp_file_across_cluster(unit: str, localpath: str, remotepath: str, timeout:
try:
rsync(
"-z",
"-v",
"--timeout",
f"{timeout}",
"--inplace",
Expand Down
19 changes: 13 additions & 6 deletions update_scripts/upcoming/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,27 @@ sudo pip3 install "$SCRIPT_DIR"/PyYAML-6.0.2-cp311-cp311-linux_armv7l.whl
# 4. update diskcache.sh
mv "$SCRIPT_DIR"/create_diskcache.sh /usr/local/bin/create_diskcache.sh

# 5. replace old calibrations with new yaml files. This doesn't delete old calibrations
python "$SCRIPT_DIR"/cal_convert.py "$STORAGE_DIR"/od_calibrations/cache.db
python "$SCRIPT_DIR"/cal_convert.py "$STORAGE_DIR"/pump_calibrations/cache.db

# if leader
if [ "$HOSTNAME" != "$LEADER_HOSTNAME" ]; then

# 5. remove calibrations dataset file
# 6. remove calibrations dataset file
rm -f /home/pioreactor/.pioreactor/exportable_datasets/*calibrations.yaml


# 6. fix any bad pioreactor start up systemd services
# 7. fix any bad pioreactor start up systemd services
rm -f /usr/lib/systemd/system/[email protected]
cp "$SCRIPT_DIR"/[email protected] /etc/systemd/system/
fi
echo "application/yaml yaml yml" | sudo tee -a /etc/mime.types

# 8. add new config entries
crudini --set /home/pioreactor/.pioreactor/config.ini storage temporary_cache /tmp/pioreactor_cache/local_intermittent_pioreactor_metadata.sqlite \
--set /home/pioreactor/.pioreactor/config.ini storage persistent_cache /home/pioreactor/.pioreactor/storage/local_persistent_pioreactor_metadata.sqlite

# 7. replace old calibrations with new yaml files. This doesn't delete old calibrations
python "$SCRIPT_DIR"/cal_convert.py "$STORAGE_DIR"/od_calibrations/cache.db
python "$SCRIPT_DIR"/cal_convert.py "$STORAGE_DIR"/pump_calibrations/cache.db
sudo -u pioreactor pios sync-configs --shared || :


fi

0 comments on commit c8325e8

Please sign in to comment.