Skip to content

Commit

Permalink
Merge branch 'main' into ci/torch2
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Mar 7, 2023
2 parents ded6586 + 7f9fb58 commit ce4c5f3
Show file tree
Hide file tree
Showing 14 changed files with 151 additions and 94 deletions.
18 changes: 8 additions & 10 deletions .azure/testing-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
# map the output variable from A into this job
configs: $[ dependencies.check_diff.outputs['files.diff'] ]
config: "${{ config }}"
DEVICES: $( python -c 'name = "$(Agent.Name)" ; gpus = name.split("_")[-1] if "_" in name else "0,1"; print(gpus)' )
DEVICES: $( python -c 'name = "$(Agent.Name)" ; gpus = name.split("_")[-1] if "_" in name else "0"; print(gpus)' )

condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), contains(variables['configs'], variables['config']))
# how long to run the job before automatically cancelling
Expand All @@ -49,27 +49,23 @@ jobs:
options: "--gpus=all --shm-size=8g -v /usr/bin/docker:/tmp/docker:ro"
steps:

- bash: |
echo "##vso[task.setvariable variable=CONTAINER_ID]$(head -1 /proc/self/cgroup|cut -d/ -f3)"
echo "##vso[task.setvariable variable=CUDA_VISIBLE_DEVICES]$(DEVICES)"
displayName: 'Set environment variables'
- bash: |
whoami && id
lspci | egrep 'VGA|3D'
whereis nvidia
nvidia-smi
echo $CUDA_VISIBLE_DEVICES
echo $CONTAINER_ID
python --version
pip --version
pip list
python -c "import torch ; print(torch.cuda.get_arch_list())"
echo "##vso[task.setvariable variable=CUDA_VISIBLE_DEVICES]$(DEVICES)"
displayName: 'Image info & NVIDIA'
- script: |
/tmp/docker exec -t -u 0 $CONTAINER_ID \
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
container_id=$(head -1 /proc/self/cgroup|cut -d/ -f3)
/tmp/docker exec -t -u 0 $container_id \
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
echo "##vso[task.setvariable variable=CONTAINER_ID]$container_id"
displayName: 'Install Sudo in container (thanks Microsoft!)'
- bash: |
Expand All @@ -82,6 +78,8 @@ jobs:
displayName: 'Install dependencies'
- bash: |
echo $CUDA_VISIBLE_DEVICES
echo $CONTAINER_ID
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu > 0, f'GPU: {mgpu}'"
displayName: 'Sanity check'
Expand Down
7 changes: 5 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ assignees: ''

<!-- A clear and concise description of what you expected to happen. -->

### Environment
### Additional context

<details>
<summary>Environment</summary>

- OS (e.g., Linux):
- Python version:
- PyTorch Version (e.g., 1.0):
- How you installed PyTorch (`conda`, `pip`, source):
- Any other relevant information:

### Additional context
</details>

<!-- Add any other context about the problem here. -->
4 changes: 0 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ assignees: ''

<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too -->

### Pitch

<!-- A clear and concise description of what you want to happen. -->

### Alternatives

<!-- A clear and concise description of any alternative solutions or features you've considered, if any. -->
Expand Down
24 changes: 14 additions & 10 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
## Before submitting
## What does this PR do?

- [ ] Was this discussed/approved via a GitHub issue? (no need for typos and docs improvements)
- [ ] Did you create/update your **configuration file**?
- [ ] Did you **set `runtimes` in config** for GitHub action integration?
- [ ] Did you **add your config to CI** in Azure pipeline (only projects with 100+ GitHub stars)?
- [ ] Are all integration **tests passing**?
Fixes # <issue> (add a link to the created issue in your repository if any)
OR link your project for clarity.

## What does this PR do? \[optional\]
<details>
<summary>Before submitting</summary>

Fixes # (issue) \[add a link to the created issue in your repository if any\]
OR link your project for clarity.
- [ ] Was this discussed/agreed via a GitHub issue? (no need for typos and docs improvements)
- [ ] Did you create/update your **configuration file**? (in case you are adding new integration)
- Did you **set `runtimes` in config** for GitHub action integration?
- [ ] Are all integration **tests passing**?

</details>

## Did you have fun?
<!--
Did you have fun?
Make sure you had fun coding 🙃
-->
10 changes: 9 additions & 1 deletion .github/workflows/ci_compatible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
matrix: ${{ steps.diff-files.outputs.runtimes }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down Expand Up @@ -114,8 +114,16 @@ jobs:
watcher:
runs-on: ubuntu-latest
needs: pytester
if: always()
steps:
- run: echo "${{ needs.pytester.result }}"
- name: failing...
if: needs.pytester.result == 'failure'
run: exit 1
- name: cancelled or skipped...
if: contains(fromJSON('["cancelled", "skipped"]'), needs.pytester.result)
timeout-minutes: 1
run: sleep 90


messenger:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_test-acts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dockers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Build and Publish Docker Hub
# publish master/release
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
build-args: |
PYTORCH_VERSION=${{ matrix.pytorch_version }}
Expand Down
27 changes: 9 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,10 @@ repos:
args: [--py38-plus]
name: Upgrade code

- repo: https://github.com/PyCQA/docformatter
rev: v1.5.1
- repo: https://github.com/omnilib/ufmt
rev: v2.0.1
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries=120, --wrap-descriptions=120]

- repo: https://github.com/PyCQA/isort
rev: 5.11.4
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
name: Black code
- id: ufmt

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
Expand All @@ -57,8 +45,11 @@ repos:
rev: v1.4.0
hooks:
- id: yesqa
additional_dependencies:
- pep8-naming

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.254
hooks:
- id: flake8
- id: ruff
args: ["--fix"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2021-2022 Lightning-AI team
Copyright 2021-2023 Lightning-AI team

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Automated Testing for Lightning EcoSystem Projects**

[![Lightning](https://img.shields.io/badge/-Lightning-792ee5?logo=pytorchlightning&logoColor=white)](https://pytorchlightning.ai)
[![Lightning](https://img.shields.io/badge/-Lightning-792ee5?logo=pytorchlightning&logoColor=white)](https://lightning.ai)
[![CI internal](https://github.com/Lightning-AI/ecosystem-ci/actions/workflows/ci_test-acts.yml/badge.svg?branch=main&event=push)](https://github.com/Lightning-AI/ecosystem-ci/actions/workflows/ci_test-acts.yml)
[![codecov](https://codecov.io/gh/Lightning-AI/ecosystem-ci/branch/main/graph/badge.svg?token=binMTx5wr4)](https://codecov.io/gh/Lightning-AI/ecosystem-ci)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Lightning-AI/ecosystem-ci/main.svg)](https://results.pre-commit.ci/latest/github/Lightning-AI/ecosystem-ci/main)
Expand Down Expand Up @@ -73,10 +73,10 @@ Here are pre-requisites for your project before adding to the Lightning EcoSyste
### Additional suggestions and engagement rules
- To qualify for GPU machines we require your project to have 100+ GitHub stars (please note that this is for capacity reasons and may change in the future)
- (**Optional**) Join our [Slack](https://www.pytorchlightning.ai/community) channel `#alerts-ecosystem-ci` to be notified if your project is breaking
- (**Optional**) Join our [Slack](https://www.lightning.ai/community) channel `#alerts-ecosystem-ci` to be notified if your project is breaking
- (**Kind request**) include Lightning badge in your readme:
```md
[![Lightning](https://img.shields.io/badge/-Lightning-792ee5?logo=pytorchlightning&logoColor=white)](https://pytorchlightning.ai)
[![Lightning](https://img.shields.io/badge/-Lightning-792ee5?logo=pytorchlightning&logoColor=white)](https://lightning.ai)
```
## Configuring my project
Expand Down
32 changes: 17 additions & 15 deletions _actions/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ class AssistantCLI:
_MANDATORY_FIELDS = (_FIELD_TARGET_REPO, _FIELD_REQUIRE)
_FOLDER_TESTS = "_integrations"
_PATH_CONFIGS = os.path.join(_PATH_ROOT, "configs")
_STATUS_SIGN = dict(success=":white_check_mark:", failure=":x:", cancelled=":no_entry_sign:")
_STATUS_SIGN = {
"success": ":white_check_mark:",
"failure": ":x:",
"cancelled": ":no_entry_sign:",
"skipped": ":grey_question:",
}

@staticmethod
def folder_local_tests() -> str:
Expand All @@ -69,8 +74,7 @@ def find_all_configs(configs_folder: str = _PATH_CONFIGS) -> List[str]:
"""Find all configs YAML|YML in given folder recursively."""
files = glob.glob(os.path.join(configs_folder, "**", "*.yaml"), recursive=True)
files += glob.glob(os.path.join(configs_folder, "**", "*.yml"), recursive=True)
files = [cfg.replace("configs/", "") if cfg.startswith("configs/") else cfg for cfg in files]
return files
return [cfg.replace("configs/", "") if cfg.startswith("configs/") else cfg for cfg in files]

@staticmethod
def list_runtimes(pr: Optional[int] = None, auth_token: Optional[str] = None) -> str:
Expand Down Expand Up @@ -141,8 +145,7 @@ def _https(
@staticmethod
def _extras(extras: Union[str, list, tuple] = "") -> str:
"""Create a list of eventual extras fro pip installation."""
extras = ",".join(extras) if isinstance(extras, (tuple, list, set)) else extras
return extras
return ",".join(extras) if isinstance(extras, (tuple, list, set)) else extras

@staticmethod
def _get_flags(repo: dict, defaults: Sequence[str] = ("--quiet",)) -> List[str]:
Expand All @@ -153,8 +156,10 @@ def _get_flags(repo: dict, defaults: Sequence[str] = ("--quiet",)) -> List[str]:

@staticmethod
def _install_pip(repo: Dict[str, str]) -> str:
"""Create command for installing a project from source (if HTTPS is given) or from PyPI (if at least name is
given).
"""Create command for installing a project from source or from PyPI.
- source: if HTTPS is given
- PyPI: if at least name is iven
Args:
repo: it is package or repository with additional key fields
Expand Down Expand Up @@ -188,8 +193,7 @@ def _install_pip(repo: Dict[str, str]) -> str:
if "checkout" in repo:
pkg += f"=={repo['checkout']}"
flags = AssistantCLI._get_flags(repo, defaults=("--quiet", "--upgrade"))
cmd = " ".join(["pip install", pkg, " ".join(flags)])
return cmd
return " ".join(["pip install", pkg, " ".join(flags)])

@staticmethod
def _install_repo(repo: Dict[str, str], remove_dir: bool = True) -> List[str]:
Expand Down Expand Up @@ -250,7 +254,7 @@ def before_commands(
config = AssistantCLI._load_config(config_file)
cmds = config.get(f"before_{stage}", [])
if not as_append:
cmds = os.linesep.join(list(AssistantCLI._BASH_SCRIPT) + cmds)
return os.linesep.join(list(AssistantCLI._BASH_SCRIPT) + cmds)
return cmds

@staticmethod
Expand Down Expand Up @@ -308,15 +312,13 @@ def prepare_env(config_file: str = "config.yaml", path_root: str = _PATH_ROOT) -

@staticmethod
def _pytest_dirs(dirs: Union[None, str, list, tuple] = "") -> str:
dirs = "." if not dirs else dirs
dirs = " ".join(dirs) if isinstance(dirs, (tuple, list, set)) else dirs
return dirs
dirs = dirs if dirs else "."
return " ".join(dirs) if isinstance(dirs, (tuple, list, set)) else dirs

@staticmethod
def _pytest_args(args: Union[None, str, list, tuple] = "") -> str:
args = args or ""
args = " ".join(args) if isinstance(args, (tuple, list, set)) else args
return args
return " ".join(args) if isinstance(args, (tuple, list, set)) else args

@staticmethod
def specify_tests(config_file: str = "config.yaml") -> str:
Expand Down
Loading

0 comments on commit ce4c5f3

Please sign in to comment.