<commit_before>#!/bin/bash

#### Rollback will not be complete until "shifterimg pull ..." runs
#### on NERSC. There is a cron job that does this every 5 minutes
#### on cori. Even once the "shifterimg pull ..." runs, users
#### with open notebooks will still need to reload their kernel
#### in order to get back to the older docker image.

set -euf -o pipefail

NO_TAG="wjhjgi/metatlas_shifter"
TAG=""

while [[ "$#" -gt 0 ]]; do
  case "$1" in
    -t|--tag) TAG="$2"; shift ;;
    -h|--help)
        echo -e "$0 [options]"
        echo ""
        echo "   -h, --help          show this command reference"
        echo "   -t, --tag string    tag value to revert to" 
        exit 0
        ;;
    *)echo "Unknown parameter passed: $1"; exit 1 ;;
  esac
  shift
done

if [ -z "$TAG" ]; then
  >&2 echo "ERROR: You must supply a tag value."
  exit 1
fi

FULL_ID="${NO_TAG}:${TAG}"
LATEST_ID="${NO_TAG}:${TAG}"

docker pull "$FULL_ID"
docker tag "$FULL_ID" "$LATEST_ID"
docker push "$LATEST_ID"<commit_msg>fix logic error in rollback script (#398)<commit_after>#!/bin/bash

#### Rollback will not be complete until "shifterimg pull ..." runs
#### on NERSC. There is a cron job that does this every 5 minutes
#### on cori. Even once the "shifterimg pull ..." runs, users
#### with open notebooks will still need to reload their kernel
#### in order to get back to the older docker image.

set -euf -o pipefail

SHORT="metatlas_shifter"
LONG="wjhjgi/$SHORT"
TAG=""

while [[ "$#" -gt 0 ]]; do
  case "$1" in
    -t|--tag) TAG="$2"; shift ;;
    -h|--help)
        echo -e "$0 [options]"
        echo ""
        echo "   -h, --help          show this command reference"
        echo "   -t, --tag string    tag value to revert to" 
        exit 0
        ;;
    *)echo "Unknown parameter passed: $1"; exit 1 ;;
  esac
  shift
done

if [ -z "$TAG" ]; then
  >&2 echo "ERROR: You must supply a tag value."
  exit 1
fi

FULL_ID="${LONG}:${TAG}"
LATEST_ID="${LONG}:latest"

docker pull "$FULL_ID"
docker tag "$FULL_ID" "$LATEST_ID"
docker push "$LATEST_ID"
{'fraction_non_alphanumeric': 0.15422157149829185, 'fraction_numerical': 0.011224987798926306, 'mean_word_length': 2.727272727272727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3070543', 'n_tokens_mistral': 741, 'n_tokens_neox': 680, 'n_words': 266}