<commit_before>#!/bin/sh

tg=tile/tg
ts=tile/ts

nproc=`nproc`
THREADS=`perl -e '$n=int($ARGV[0]*0.75); print $n > 0 ? $n : 1'`

status() {
  docker ps -a

  echo ""
  echo "==> A"
  cat /export/tile-a/status.txt
  echo ""
  echo "==> B"
  cat /export/tile-b/status.txt
}

build() {
  test -d /export/tile-"$1" || return 1
  docker rm gen-"$1"
  docker run -d \
    --name gen-"$1" \
    -v /export/scratch:/export/scratch \
    -v /export/tile-"$1":/export/tile \
    -v /export/build:/export/build \
    -e THREADS=$THREADS \
    -e CACHEDIR=/export/scratch/cache \
    -e PLANETPBF=/export/scratch/planet-latest.osm.pbf \
    -p 8888:8888 \
    $tg
}

serve() {
  test -d /export/tile-"$1" || return 1
  docker run -d \
    --name tile-"$1" \
    --log-opt max-size=100m --log-opt max-file=10 \
    --restart=unless-stopped \
    -v /export/tile-"$1":/export/tile:ro \
    -p `perl -e "print 8080 + ord('$1') - ord('a')"`:80 \
    $ts
}

stop() {
  case "$1" in
    build)
      docker stop gen-a gen-b gen
      ;;
    *)
      docker stop tile-"$1"
      ;;
  esac
}

clean() {
  docker stop gen gen-a gen-b tile-a tile-b
  docker rm gen gen-a gen-b tile-a tile-b<commit_msg>Fix arg<commit_after>#!/bin/sh

tg=tile/tg
ts=tile/ts

nproc=`nproc`
THREADS=`perl -e '$n=int($ARGV[0]*0.75); print $n > 0 ? $n : 1'`

status() {
  docker ps -a

  echo ""
  echo "==> A"
  cat /export/tile-a/status.txt
  echo ""
  echo "==> B"
  cat /export/tile-b/status.txt
}

build() {
  test -d /export/tile-"$1" || return 1
  docker rm gen-"$1"
  docker run -d \
    --name gen-"$1" \
    -v /export/scratch:/export/scratch \
    -v /export/tile-"$1":/export/tile \
    -v /export/build:/export/build \
    -e THREADS=$THREADS \
    -e CACHEDIR=/export/scratch/cache \
    -e PLANETPBF=/export/scratch/planet-latest.osm.pbf \
    -p 8888:8888 \
    $tg
}

serve() {
  test -d /export/tile-"$1" || return 1
  docker run -d \
    --name tile-"$1" \
    --log-opt max-size=100m --log-opt max-file=10 \
    --restart=unless-stopped \
    -v /export/tile-"$1":/export/tile:ro \
    -p `perl -e "print 8080 + ord('$1') - ord('a')"`:80 \
    $ts
}

stop() {
  case "$1" in
    build)
      docker stop gen-a gen-b gen
      ;;
    *)
      docker stop tile-"$2"
      ;;
  esac
}

clean() {
  docker stop gen gen-a gen-b tile-a tile-b
  docker rm gen gen-a gen-b tile-a tile-b
{'fraction_non_alphanumeric': 0.20305862361937127, 'fraction_numerical': 0.03143585386576041, 'mean_word_length': 2.026992287917738, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 9, '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': '6007003', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1009, 'n_words': 220}