Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/spawn-globals-2
Browse files Browse the repository at this point in the history
  • Loading branch information
tchaton authored Aug 1, 2022
2 parents f3fbc4f + 98f7326 commit eab9c16
Show file tree
Hide file tree
Showing 39 changed files with 440 additions and 221 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-app_cloud_e2e_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.8"

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.8"

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

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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pytorch_test-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
if: ${{ (steps.skip.outputs.continue == '1') }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pytorch_test-slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
echo "::set-output name=continue::1"
fi
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
if: ${{ (steps.skip.outputs.continue == '1') }}
with:
python-version: ${{ matrix.python-version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_pkg-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
with:
submodules: true
# lfs: true
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
# If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/events-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
# does nightly releases from feature branch
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/legacy-checkpoints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
pull-pkgs: ${{ steps.download.outputs.pkgs }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9
- run: |
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
with:
name: dist-packages-${{ github.sha }}
path: dist
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
with:
name: pypi-packages-${{ github.sha }}
path: pypi
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
name: pypi-packages-${{ github.sha }}
path: pypi
- run: ls -lh pypi/
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down Expand Up @@ -222,7 +222,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,4 @@ src/lightning_app/ui/*
hars*
artifacts/*
*docs/examples*
*docs/source-app/api*
26 changes: 26 additions & 0 deletions docs/source-app/api_reference/core.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
:orphan:

##################
lightning_app.core
##################

.. contents::
:depth: 1
:local:
:backlinks: top

.. currentmodule:: lightning_app.core

Core APIs
___________________

.. autosummary::
:toctree: api/
:nosignatures:
:template: classtemplate.rst

LightningApp
LightningFlow
LightningWork

Learn more about :ref:`Lightning Core <core_api>`.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Lightning App - API References
##############################

Core
----
____

.. currentmodule:: lightning_app.core

.. autosummary::
:toctree: api
:toctree: api/
:nosignatures:
:template: classtemplate_no_index.rst

Expand All @@ -32,10 +32,10 @@ ___________________
:nosignatures:
:template: classtemplate_no_index.rst

~serve.serve.ModelInferenceAPI
~python.popen.PopenPythonScript
~serve.gradio.ServeGradio
~python.tracer.TracerPythonScript
~serve.gradio.ServeGradio
~serve.serve.ModelInferenceAPI

----

Expand Down Expand Up @@ -67,8 +67,8 @@ _______
:nosignatures:
:template: classtemplate_no_index.rst

~drive.Drive
~path.Path
~drive.Drive
~payload.Payload

Learn more about :ref:`Storage <storage>`.
Expand All @@ -86,5 +86,5 @@ _______
:template: classtemplate_no_index.rst

~cloud.CloudRuntime
~multiprocess.MultiProcessRuntime
~singleprocess.SingleProcessRuntime
~multiprocess.MultiProcessRuntime
19 changes: 16 additions & 3 deletions docs/source-app/examples/file_server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@


class FileServer(L.LightningWork):
def __init__(self, drive: Drive, base_dir: str = "file_server", chunk_size=10240, **kwargs):
def __init__(
self,
drive: Drive,
base_dir: str = "file_server",
chunk_size=10240,
**kwargs
):
"""This component uploads, downloads files to your application.
Arguments:
Expand Down Expand Up @@ -48,7 +54,9 @@ def upload_file(self, file):
filename = file.filename
uploaded_file = self.get_random_filename()
meta_file = uploaded_file + ".meta"
self.uploaded_files[filename] = {"progress": (0, None), "done": False}
self.uploaded_files[filename] = {
"progress": (0, None), "done": False
}

# 2: Create a stream and write bytes of
# the file to the disk under `uploaded_file` path.
Expand Down Expand Up @@ -155,6 +163,7 @@ def alive(self):


class TestFileServer(LightningWork):

def __init__(self, drive: Drive):
super().__init__(cache_calls=True)
self.drive = drive
Expand All @@ -164,7 +173,10 @@ def run(self, file_server_url: str, first=True):
with open("test.txt", "w") as f:
f.write("Some text.")

response = requests.post(file_server_url + "/upload_file/", files={"file": open("test.txt", "rb")})
response = requests.post(
file_server_url + "/upload_file/",
files={'file': open("test.txt", 'rb')}
)
assert response.status_code == 200
else:
response = requests.get(file_server_url)
Expand All @@ -176,6 +188,7 @@ def run(self, file_server_url: str, first=True):


class Flow(LightningFlow):

def __init__(self):
super().__init__()
# 1: Create a drive to share data between works
Expand Down
8 changes: 4 additions & 4 deletions docs/source-app/examples/file_server/file_server.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

.. _fileserver_example:

###################
Build a File Server
###################
#####################
Develop a File Server
#####################

**Prerequisite**: Reach :ref:`level 16+ <intermediate_level>` and read the `Drive article <https://lightning.ai/lightning-docs/glossary/storage/drive_content.html>`_.
**Prerequisite**: Reach :ref:`level 16+ <intermediate_level>` and read the :ref:`Drive article <drive_storage>`.

----

Expand Down
Loading

0 comments on commit eab9c16

Please sign in to comment.