Skip to content

Commit

Permalink
Merge branch 'master' into 0.10-to-master
Browse files Browse the repository at this point in the history
  • Loading branch information
shadeofblue committed Jun 12, 2023
2 parents 727bd22 + 3573e7f commit 68fcef4
Show file tree
Hide file tree
Showing 169 changed files with 2,139 additions and 1,125 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/add-to-sdk-team-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Add New Issues To SDK Team Project

on:
issues:
types:
- opened

jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v0.1.0
with:
project-url: https://github.com/orgs/golemfactory/projects/32
github-token: ${{ secrets.SDK_BOARD_ACTIONS_TOKEN }}
12 changes: 6 additions & 6 deletions .github/workflows/build_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
python-version: '3.9'
- uses: Gr1N/setup-poetry@v8
- run: poetry install
- run: poetry run poe test
- run: poetry run poe typecheck
- run: poetry run poe codestyle
- run: poetry run poe liccheck
- run: poetry run poe tests_unit
- run: poetry run poe checks_codestyle
- run: poetry run poe checks_typing
- run: poetry run poe checks_license

build:
needs: [test]
Expand All @@ -33,10 +33,10 @@ jobs:
python-version: '3.9'
- uses: Gr1N/setup-poetry@v8
- name: Get git release tag
run: echo "::set-output name=git-release-tag::yapapi $(git describe --tags)"
run: echo "git-release-tag=yapapi $(git describe --tags)" >> $GITHUB_OUTPUT
id: git_describe
- name: Get package version
run: echo "::set-output name=poetry-version::$(poetry version)"
run: echo "poetry-version=$(poetry version)" >> $GITHUB_OUTPUT
id: poetry_version
- name: Fail on version mismatch
run: exit 1
Expand Down
40 changes: 21 additions & 19 deletions .github/workflows/goth-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,44 @@ jobs:
# second sed expression removes leading whitespaces and '*' characters (git uses it to indicate the current branch)
run: |
branch=$(git branch -a | sed -e 's:remotes/origin/::' -e 's:^[ \t*]*::' | grep -E '^b[0-9]+(\.[0-9]+)+$' | sort -Vr | head -1)
echo "::set-output name=branch::$branch"
echo "branch=$branch" >> $GITHUB_OUTPUT
# prepares JSON object representing strategy matrix which contains two 'branch' variants: master and latest stable
- name: Get matrix JSON
id: get-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"branch\":\"master\"},{\"branch\":\"${{ steps.latest-stable.outputs.branch }}\"}]}"
run: echo "matrix={\"include\":[{\"branch\":\"master\"},{\"branch\":\"${{ steps.latest-stable.outputs.branch }}\"}]}" >> $GITHUB_OUTPUT

goth-tests:
runs-on: goth
runs-on: [goth, ubuntu-18.04]
needs: prepare-matrix
strategy:
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix-json) }}
fail-fast: false
name: Run integration tests (nightly) on ${{ matrix.branch }}
steps:
- name: install docker-compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.4/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose
sudo chmod a+x /usr/local/bin/docker-compose
- name: install ffi and gcc
run: sudo apt-get install -y libffi-dev build-essential

- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ matrix.branch }}

- name: Configure python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Configure poetry
uses: Gr1N/setup-poetry@v8
- name: Install and configure Poetry
run: python -m pip install -U pip setuptools poetry==1.3.2

- name: Install dependencies
run: |
poetry env use python3.9
poetry install -E integration-tests
- name: Install websocat
run: |
sudo wget https://github.com/vi/websocat/releases/download/v1.9.0/websocat_linux64 -O /usr/local/bin/websocat
sudo chmod +x /usr/local/bin/websocat
poetry install
- name: Disconnect Docker containers from default network
continue-on-error: true
Expand All @@ -80,19 +81,20 @@ jobs:
- name: Log in to GitHub Docker repository
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{github.actor}} --password-stdin

- name: Initialize the test suite
run: poetry run poe tests_integration_init

- name: Run test suite
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry run poe goth-assets
poetry run poe goth-tests
run: poetry run poe tests_integration

- name: Upload test logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: always()
with:
name: goth-logs
path: /tmp/goth-tests
name: goth-logs
path: /tmp/goth-tests

# Only relevant for self-hosted runners
- name: Remove test logs
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/goth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ on:
jobs:
goth-tests:
name: Run integration tests
runs-on: goth
runs-on: [goth, ubuntu-18.04]
steps:
- name: install docker-compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.4/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose
sudo chmod a+x /usr/local/bin/docker-compose
- name: install ffi and gcc
run: sudo apt-get install -y libffi-dev build-essential

- name: Checkout
uses: actions/checkout@v3

Expand All @@ -24,13 +32,13 @@ jobs:
with:
python-version: '3.9'

- name: Configure poetry
uses: Gr1N/setup-poetry@v8
- name: Install and configure Poetry
run: python -m pip install -U pip setuptools poetry==1.3.2

- name: Install dependencies
run: |
poetry env use python3.9
poetry install -E integration-tests
poetry install
- name: Disconnect Docker containers from default network
continue-on-error: true
Expand All @@ -51,12 +59,13 @@ jobs:
- name: Log in to GitHub Docker repository
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{github.actor}} --password-stdin

- name: Initialize the test suite
run: poetry run poe tests_integration_init

- name: Run test suite
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry run poe goth-assets
poetry run poe goth-tests
run: poetry run poe tests_integration

- name: Upload test logs
uses: actions/upload-artifact@v2
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
os:
- ubuntu-latest
- macos-latest
Expand All @@ -34,24 +34,25 @@ jobs:
python-version: ${{ matrix.python-version }}
- uses: Gr1N/setup-poetry@v8

- run: echo "::set-output name=ENABLE::1"
- run: echo "ENABLE=1" >> $GITHUB_OUTPUT
if: ${{ matrix.os == 'ubuntu-latest' }}
name: Enable extended checks
id: extended-checks
- run: echo "::set-output name=ENABLE::1"
- run: echo "ENABLE=1" >> $GITHUB_OUTPUT
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' }}
name: Enable sphinx check
id: extended-checks-sphinx

- run: poetry install
if: ${{ !steps.extended-checks-sphinx.outputs.ENABLE }}
- run: poetry install -E docs
if: ${{ steps.extended-checks-sphinx.outputs.ENABLE }}

- run: poetry run poe test
- run: poetry run poe typecheck
- run: poetry run poe codestyle
- run: poetry run poe tests_unit
- run: poetry run poe checks_codestyle
- run: poetry run poe checks_typing
if: ${{ steps.extended-checks.outputs.ENABLE }}
- run: poetry run poe liccheck
- run: poetry run poe checks_license
if: ${{ steps.extended-checks.outputs.ENABLE }}
- run: poetry run poe sphinx -W
if: ${{ steps.extended-checks-sphinx.outputs.ENABLE }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ __pycache__/
*.log
*.png
.coverage
.requirements.txt
requirements.txt

tests/goth_tests/assets/

Expand Down
69 changes: 38 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@

## What's Golem and yapapi?

**[Golem](https://golem.network)** is a global, open-source, decentralized supercomputer that anyone can access.
It connects individual machines to form a vast network which combines their resources and allows requestors to utilize its unique potential - which may be its combined computing power, storage, the geographical distribution or its censorship resistance.
**[The Golem Network](https://golem.network)** fosters a global group of creators building ambitious software solutions that will shape the technological landscape of future generations by accessing computing resources across the platform. Golem Network is an accessible, reliable, open access and censorship-resistant protocol, democratizing access to digital resources and connecting users through a flexible, open-source platform.

**Yapapi** is the Python high-level API that allows developers to connect to their Golem nodes and manage their distributed, computational loads through Golem Network.

## Golem application development

For a detailed introduction to using Golem and yapapi to run your tasks on Golem and a guide to Golem Network application development in general, [please consult our handbook](https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development).


### Installation

`yapapi` is available as a [PyPI package](https://pypi.org/project/yapapi/).

You can install it through `pip`:
```

```bash
pip install yapapi
```

Or if your project uses [`poetry`](https://python-poetry.org/) you can add it to your dependencies like this:
```

```bash
poetry add yapapi
```

Expand All @@ -40,19 +40,24 @@ For a comprehensive API reference, please refer to [our official readthedocs pag
## Local setup for yapapi developers

### Poetry

`yapapi` uses [`poetry`](https://python-poetry.org/) to manage its dependencies and provide a runner for common tasks.

If you don't have `poetry` available on your system then follow its [installation instructions](https://python-poetry.org/docs/#installation) before proceeding.
Verify your installation by running:
```

```bash
poetry --version
```

### Project dependencies

To install the project's dependencies run:
```

```bash
poetry install
```

By default, `poetry` looks for the required Python version on your `PATH` and creates a virtual environment for the project if there's none active (or already configured by Poetry).

All of the project's dependencies will be installed to that virtual environment.
Expand All @@ -62,8 +67,8 @@ All of the project's dependencies will be installed to that virtual environment.
`yapapi` uses [Poe the Poet](https://github.com/nat-n/poethepoet) for running tasks.
Declarations of project tasks can be found in `pyproject.toml`.

```
poetry run poe test
```bash
poetry run poe tests_unit
```

### Running `goth` integration tests
Expand All @@ -78,69 +83,71 @@ Next, [configure goth's GitHub API token](https://github.com/golemfactory/goth#g

Make sure you have OpenSSH installed and added to path

```
```bash
ssh -V
```

Now, you can install goth and its additional python requirements:

```
```bash
poetry install -E integration-tests
```

Finally, generate goth's default assets:

```
poetry run poe goth-assets
```bash
poetry run poe tests_integration_assets
```

#### Running the tests

Once you have the environment set up, to run all the integration tests, use:

```
poetry run poe goth-tests
```bash
poetry run poe tests_integration
```

### Contributing

It is recommended to run unit tests and static code analysis before committing changes.

```
poetry run poe check
```bash
poetry run poe checks
```

You can clean up the artifacts created during the test runs with:

```
```bash
poetry run poe clean
```

## See also

* [Golem](https://golem.network), a global, open-source, decentralized supercomputer that anyone can access.
* Learn what you need to know to set-up your Golem requestor node:
* [Requestor development: a quick primer](https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development)
* [Run first task on Golem](https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development/run-first-task-on-golem)
* [Requestor development: a quick primer](https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development)
* [Run first task on Golem](https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development/run-first-task-on-golem)
* Have a look at the most important concepts behind any Golem application: [Golem application fundamentals](https://handbook.golem.network/requestor-tutorials/golem-application-fundamentals)
* Learn about preparing your own Docker-like images for the [VM runtime](https://handbook.golem.network/requestor-tutorials/vm-runtime)
* Write your own app with yapapi:
* [Task Model development](https://handbook.golem.network/requestor-tutorials/task-processing-development)
* [Service Model development](https://handbook.golem.network/requestor-tutorials/service-development)
* [Task Model development](https://handbook.golem.network/requestor-tutorials/task-processing-development)
* [Service Model development](https://handbook.golem.network/requestor-tutorials/service-development)

## Environment variables

It's possible to set various elements of `yagna` configuration through environment variables.
`yapapi` currently supports the following environment variables:
- `YAGNA_ACTIVITY_URL`, URL to `yagna` activity API, e.g. `http://localhost:7500/activity-api/v1`
- `YAGNA_API_URL`, base URL to `yagna` REST API, e.g. `http://localhost:7500`
- `YAGNA_APPKEY`, `yagna` app key to be used, e.g. `a70facb9501d4528a77f25574ab0f12b`
- `YAGNA_MARKET_URL`, URL to `yagna` market API, e.g. `http://localhost:7500/market-api/v1`
- `YAGNA_PAYMENT_NETWORK`, Ethereum network name for `yagna` to use, e.g. `rinkeby`
- `YAGNA_PAYMENT_DRIVER`, payment driver name for `yagna` to use, e.g. `erc20`
- `YAGNA_PAYMENT_URL`, URL to `yagna` payment API, e.g. `http://localhost:7500/payment-api/v1`
- `YAGNA_SUBNET`, name of the `yagna` sub network to be used, e.g. `public`
- `YAPAPI_USE_GFTP_CLOSE`, if set to a _truthy_ value (e.g. "1", "Y", "True", "on") then `yapapi`

* `YAGNA_ACTIVITY_URL`, URL to `yagna` activity API, e.g. `http://localhost:7500/activity-api/v1`
* `YAGNA_API_URL`, base URL to `yagna` REST API, e.g. `http://localhost:7500`
* `YAGNA_APPKEY`, `yagna` app key to be used, e.g. `a70facb9501d4528a77f25574ab0f12b`
* `YAGNA_MARKET_URL`, URL to `yagna` market API, e.g. `http://localhost:7500/market-api/v1`
* `YAGNA_PAYMENT_NETWORK`, Ethereum network name for `yagna` to use, e.g. `rinkeby`
* `YAGNA_PAYMENT_DRIVER`, payment driver name for `yagna` to use, e.g. `erc20`
* `YAGNA_PAYMENT_URL`, URL to `yagna` payment API, e.g. `http://localhost:7500/payment-api/v1`
* `YAGNA_NET_URL`, URL to `yagna` net APU, e.g. `http://localhost:7500/net-api/v1`
* `YAGNA_SUBNET`, name of the `yagna` sub network to be used, e.g. `public`
* `YAPAPI_USE_GFTP_CLOSE`, if set to a _truthy_ value (e.g. "1", "Y", "True", "on") then `yapapi`
will ask `gftp` to close files when there's no need to publish them any longer. This may greatly
reduce the number of files kept open while `yapapi` is running but requires `yagna`
0.7.3 or newer, with older versions it will cause errors.
Loading

0 comments on commit 68fcef4

Please sign in to comment.