Skip to content

Commit

Permalink
Provide default value for y axis limit
Browse files Browse the repository at this point in the history
A previous change incorrectly made ceiling a required variable, breaking
my Docker deployment, which relied on the default auto-ranging behavior.
This commit makes this argument optional, as intended.

Bonus changes:
* Pipe stdout and stderr of `crossword` to make it a little easier to
debug issues from logs.
* Add a reference to remind myself how to actually use Docker.
  • Loading branch information
kesyog committed Oct 4, 2023
1 parent 88bed7d commit f53cfec
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
7 changes: 6 additions & 1 deletion cloud_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ def generate_plot():


def update_csv():
subprocess.run(["crossword", LOCAL_CSV_FILENAME], check=True)
subprocess.run(
["crossword", LOCAL_CSV_FILENAME],
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)


@app.route("/")
Expand Down
21 changes: 21 additions & 0 deletions docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Docker + Cloud Run

Documenting my janky workflow.

Image name: `us.gcr.io/<project id>/<image name>`

```sh
# Refresh credentials
gcloud auth login

# Building an image
docker build -t `<image name>` .

# Open a shell in container so you can run commands and test
docker run -it --rm us.gcr.io/xword-stats/xword:latest bash

# Push image to registry
docker push us.gcr.io/xword-stats/xword:latest

# Use Cloud console to point Cloud Run to latest image
```
4 changes: 2 additions & 2 deletions plot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ def save_split_vln_plot(df, out_path, ymax):
plt.close()


def generate(in_file, out_file, ceiling):
def generate(in_file, out_file, ceiling = None):
df = parse_data(in_file)

if ceiling == 0:
if ceiling is None:
# Pick an appropriate y-axis, balancing being robust to outliers vs. showing all data
ymax = df["solve_time_secs"].quantile(0.99) / 60
else:
Expand Down

0 comments on commit f53cfec

Please sign in to comment.