Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Add justfile with scripts and update README #153

Merged
merged 9 commits into from
Sep 1, 2021
Merged

Conversation

sarayourfriend
Copy link
Contributor

Fixes

Fixes WordPress/openverse#1718 by @sarayourfriend

Description

Adds a justfile and updates the README to reference those scripts. This simplifies the README and the development process by moving repetative docker/docker-compose tasks into a command runner.

Tests

Install just and take some of the scripts for a spin and make sure they work.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@sarayourfriend sarayourfriend requested a review from a team as a code owner August 24, 2021 18:59
README.md Show resolved Hide resolved
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just excellent 😎

@@ -141,47 +142,47 @@ and some networking setup so that they can communicate. Note:
At this stage, you can run the tests via:

```shell
docker exec openverse_catalog_webserver_1 /usr/local/airflow/.local/bin/pytest
just test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this change!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, if you run the tests too early, before the airflow db loads, some tests fail:

AILED dags/util/test_operator_util.py::test_get_dated_main_runner_handles_zero_shift
FAILED dags/util/test_operator_util.py::test_get_dated_main_runner_handles_day_shift
FAILED dags/util/loader/test_paths.py::test_stage_oldest_tsv_file_finds_tsv_file
FAILED dags/util/loader/test_paths.py::test_stage_oldest_tsv_file_stages_tsv_file
FAILED dags/util/loader/test_paths.py::test_stage_oldest_tsv_file_removes_staged_file_from_output_dir
FAILED dags/util/loader/test_paths.py::test_stage_oldest_tsv_file_stages_older_file
FAILED dags/util/loader/test_paths.py::test_stage_oldest_tsv_file_ignores_newer_file
FAILED dags/util/loader/test_sql.py::test_create_loading_table_creates_table
FAILED dags/util/loader/test_sql.py::test_create_loading_table_errors_if_run_twice_with_same_id
FAILED dags/util/loader/test_sql.py::test_drop_load_table_drops_table - sqlal..

They pass after the db loads

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱 Does that mean we need to add a "wait for Postgres" script to the webserver entrypoint?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, or maybe just write something like 'wait a minute for db to load '?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to reproduce this. Can you share what steps you took for this to happen?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect it only happens when you first build the containers, because I tried to reproduce it now, and couldn't .

README.md Outdated Show resolved Hide resolved
justfile Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love how just makes some commands much easier!

README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to reduce the cognitive strain when running the containers :)

@@ -141,47 +142,47 @@ and some networking setup so that they can communicate. Note:
At this stage, you can run the tests via:

```shell
docker exec openverse_catalog_webserver_1 /usr/local/airflow/.local/bin/pytest
just test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect it only happens when you first build the containers, because I tried to reproduce it now, and couldn't .

@zackkrida
Copy link
Member

LGTM!

@sarayourfriend sarayourfriend merged commit 17628e7 into main Sep 1, 2021
@sarayourfriend sarayourfriend deleted the add/just-scripts branch September 1, 2021 15:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Quality] Add just file to script docker tasks
3 participants