Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetretto committed Dec 18, 2023
2 parents 6eab685 + 0032693 commit 2917456
Show file tree
Hide file tree
Showing 24 changed files with 447 additions and 160 deletions.
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ Before a pull request can be merged, the following items must be checked:
Note that the CI system will run all the above checks. But it will be much more
efficient if you already fix most errors prior to submitting the PR. It is highly
recommended that you use the pre-commit hook provided in the repository. Simply
`cp pre-commit .git/hooks` and a check will be run prior to allowing commits.
`pip install pre-commit` and then `pre-commit install` and a check will be run
prior to allowing commits.
3 changes: 3 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ changelog:
- title: Documentation 📖
labels:
- documentation
- title: House-Keeping 🧹
labels:
- house-keeping
- title: Other Changes
labels:
- "*"
8 changes: 5 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
deploy-docs:

# only run if commit is a push to master and the testing finished
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && startsWith(github.event.workflow_run.head_branch, 'v0.') }}
if: ${{ github.repository_owner == 'materialsproject' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && startsWith(github.event.workflow_run.head_branch, 'v0.') }}
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
deploy-pypi:

# only run if commit is tagged as a version and the docs finished
if: ${{ startsWith(github.event.workflow_run.head_branch, 'v') }}
if: github.repository_owner == 'materialsproject' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && startsWith(github.event.workflow_run.head_branch, 'v0.')
runs-on: ubuntu-latest
needs:
- deploy-docs
Expand Down Expand Up @@ -81,7 +81,9 @@ jobs:
ref: ${{ github.event.workflow_run.head_branch }}

- name: Write release info
run: awk 'BEGIN {p = 0} {a = 0 }; /^v\d*.\d*.\d*./ { p += 1; a = 1}; p + a == 1 { print } ' CHANGELOG.md | sed -e '1,1d' | sed -e '/./,$!d' -e :a -e '/^\n*$/{$d;N;ba' -e '}' > release_info.txt
awk 'BEGIN {p = 0} {a = 0 }; /^\#\#\ v\d*.\d*.\d*./ { p += 1; a = 1}; p + a == 1 { print } ' CHANGELOG.md | sed -e '1,1d' | sed -e '/./,$!d' -e :a -e '/^\n*$/{$d;N;ba' -e '}' > release_info.txt
echo "" >> release_info.txt
awk '/CONTRIBUTOR SECTION/{f=1; c=0} f' CHANGELOG.md >> release_info.txt

- name: Release
uses: actions/create-release@v1
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: build-docs

on:
workflow_dispatch:
push:
branches: [main]

# set GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
build-docs:
if: github.repository_owner == 'materialsproject' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_branch }}

- name: Install pandoc
run: sudo apt-get install pandoc

- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[strict,docs]
- name: Build
run: sphinx-build docs docs_build

- name: Upload build artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./docs_build

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build-docs
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
38 changes: 0 additions & 38 deletions .github/workflows/docs_manual.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check Links

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
check_links:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
pip install pytest-check-links nbconvert
- name: Run link check
run: |
pytest --check-links **/**/*.md **/**/*.ipynb --check-links-ignore "https://www.gauss-centre.eu"
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:
exclude: "^src/atomate2/vasp/schemas/calc_types/"
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.3
rev: v0.1.7
hooks:
- id: ruff
args: [--fix]
Expand All @@ -23,18 +23,18 @@ repos:
additional_dependencies: [black]
exclude: ^(README.md|paper/paper.md)$
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
entry: pflake8
files: ^src/
additional_dependencies:
- pyproject-flake8==6.0.0
- flake8-bugbear==22.12.6
- flake8-typing-imports==1.14.0
- flake8-docstrings==1.6.0
- flake8-rst-docstrings==0.3.0
- flake8-rst==0.8.0
- pyproject-flake8
- flake8-bugbear
- flake8-typing-imports
- flake8-docstrings
- flake8-rst-docstrings
- flake8-rst
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand All @@ -43,7 +43,7 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.7.1
hooks:
- id: mypy
files: ^src/
Expand Down
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Change log

## v0.1.15

### Bug Fixes 🐛
* Fix JobStoreDocument validator by @utf in https://github.com/materialsproject/jobflow/pull/478
* fix Flow deserialization for hosts by @gpetretto in https://github.com/materialsproject/jobflow/pull/499
### Enhancements 🛠
* Formalizing the JobStore document format as a pydantic model by @hrushikesh-s in https://github.com/materialsproject/jobflow/pull/424
* Simplify code by using `Flow` methods `__len__` and `__getitem__` by @janosh in https://github.com/materialsproject/jobflow/pull/467
* `run_locally()` add `root_dir: str | Path | None` keyword by @janosh in https://github.com/materialsproject/jobflow/pull/486
* Allow SSHTunnel in job stores by @mjwen in https://github.com/materialsproject/jobflow/pull/477
### Documentation 📖
* JOSS paper by @utf in https://github.com/materialsproject/jobflow/pull/446
* JOSS Paper: Add missing DOIs by @Andrew-S-Rosen in https://github.com/materialsproject/jobflow/pull/452
* JOSS Paper: Reduce line-spacing in code blocks by @Andrew-S-Rosen in https://github.com/materialsproject/jobflow/pull/454
* JOSS Paper update: Add missing year to `refs.bib` by @Andrew-S-Rosen in https://github.com/materialsproject/jobflow/pull/458
* JOSS Paper: Remove stray tick mark in "[@montydb]`" by @Andrew-S-Rosen in https://github.com/materialsproject/jobflow/pull/459
* JOSS Paper: Add another missing year to `refs.bib` by @Andrew-S-Rosen in https://github.com/materialsproject/jobflow/pull/461
* Update refs.bib by @xuanxu in https://github.com/materialsproject/jobflow/pull/462
* JOSS: Add missing `,` to paper by @Andrew-S-Rosen in https://github.com/materialsproject/jobflow/pull/479
* JOSS: Add more complete Zenodo reference info by @Andrew-S-Rosen in https://github.com/materialsproject/jobflow/pull/481
* JOSS: Fix references to include all coauthors and remove "others" by @Andrew-S-Rosen in https://github.com/materialsproject/jobflow/pull/480
* Add fibonacci example to tutorial by @JaGeo in https://github.com/materialsproject/jobflow/pull/494
### House-Keeping 🧹
* Remove `__all__` from all modules by @janosh in https://github.com/materialsproject/jobflow/pull/442
* Bump minimum Python version to 3.9 by @janosh in https://github.com/materialsproject/jobflow/pull/455
* Replace deprecated `pkg_resources` with `importlib.metadata.version` by @janosh in https://github.com/materialsproject/jobflow/pull/460
* Match `atomate2` `ruff` config by @janosh in https://github.com/materialsproject/jobflow/pull/464
* Test error messages by @janosh in https://github.com/materialsproject/jobflow/pull/465

## New Contributors
* @hrushikesh-s made their first contribution in https://github.com/materialsproject/jobflow/pull/424
* @xuanxu made their first contribution in https://github.com/materialsproject/jobflow/pull/462

**Full Changelog**: https://github.com/materialsproject/jobflow/compare/v0.1.14...v0.1.15

## v0.1.14

### Bug Fixes 🐛
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Install jobflow <install>
Install FireWorks (Optional) <install_fireworks>
Tutorials <tutorials>
Configuring Data Stores <stores>

.. toctree::
:caption: Information
Expand Down
53 changes: 53 additions & 0 deletions docs/stores.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Stores

## Overview

Jobflow relies on the [maggma package](https://github.com/materialsproject/maggma) to provide a unified interface to a variety of data stores. By default, all calculations are run using a `MemoryStore`, which persists solely in the current process' memory. In production calculations, one will generally want to use a persistent data store, such as a MongoDB database. This also allows one to run calculations in a distributed manner with a common data store.

For a list of all available data stores, refer to the [maggma documentation](https://materialsproject.github.io/maggma/getting_started/stores/#list-of-stores). Here, we will go over how to use Jobflow with MongoDB via a [`MongoStore`](https://materialsproject.github.io/maggma/reference/stores/#maggma.stores.mongolike.MemoryStore).

## Configuring a `MongoStore`

### Creating a `jobflow.yaml` File

To modify basic Jobflow settings, you will first need to make a `jobflow.yaml` file if you haven't done so already. You will then need to define a `JOBFLOW_CONFIG_FILE` environment variable pointing to the file you made. For instance, in your `~/.bashrc` file, add the following line:

```bash
export JOBFLOW_CONFIG_FILE="/path/to/my/jobflow.yaml"
```

If this environment variable is not specified, Jobflow will look for the file in `~/.jobflow.yaml`.

### Basic Configuration

In your `jobflow.yaml` copy the example below and fill in the fields with the appropriate values for a MongoDB store.

```yaml title="jobflow.yaml"
JOB_STORE:
docs_store:
type: MongoStore
host: <host name>
port: 27017
username: <username>
password: <password>
database: <database name>
collection_name: <collection name>
```
### MongoDB Atlas
If you are using a URI (as is common with MongoDB Atlas), then you will instead have a `jobflow.yaml` file that looks like the example below. Here, you will put the full URI in the `host` field. The `username` and `password` are part of the URI and so should not be included elsewhere in the YAML file.

```yaml title="jobflow.yaml"
JOB_STORE:
docs_store:
type: MongoStore
host: <URI>
port: 27017
database: <database name>
collection_name: <collection name>
```

## Additional Details

For additional details on how to specify a data store as well as the various settings available to modify in Jobflow, refer to the [API documentation](https://materialsproject.github.io/jobflow/jobflow.settings.html) for `jobflow.settings`.
2 changes: 1 addition & 1 deletion docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Tutorials
tutorials/8-fireworks

.. Note::
[@jageo](https://github.com/JaGeo) also has a set of [Jobflow tutorials](https://jageo.github.io/Advanced_Jobflow_Tutorial/intro.html) written within the context of computational materials science applications, which you may wish to check out after exploring the basics here.
`@jageo <https://github.com/JaGeo>`_ also has a set of `Jobflow tutorials <https://jageo.github.io/Advanced_Jobflow_Tutorial/intro.html>`_ written within the context of computational materials science applications, which you may wish to check out after exploring the basics here.
54 changes: 30 additions & 24 deletions docs/tutorials/2-introduction.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/tutorials/3-defining-jobs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"id": "fatal-bible",
"metadata": {},
"source": [
"Jobs also have an index. This tracks the number of times the job has been \"replaced\" (replacing is covered in detail in the [Dynamic and nested Flows tutorial](dynamic-flows)).\n"
"Jobs also have an index. This tracks the number of times the job has been \"replaced\" (replacing is covered in detail in the [Dynamic and nested Flows tutorial](5-dynamic-flows.html)).\n"
]
},
{
Expand Down Expand Up @@ -233,7 +233,7 @@
"source": [
"from jobflow.managers.local import run_locally\n",
"\n",
"response = run_locally(add(1,2))"
"response = run_locally(add(1, 2))"
]
},
{
Expand Down
Loading

0 comments on commit 2917456

Please sign in to comment.