Skip to content

Commit

Permalink
Merge pull request #8 from zzstoatzz/dev
Browse files Browse the repository at this point in the history
update documentation on prefect 1.0 usage
  • Loading branch information
zzstoatzz committed Jul 19, 2022
2 parents f411ef7 + dd30f33 commit d5dadab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 42 deletions.
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

## Welcome!

A collection of Prefect Tasks for memory profiling in Prefect 1.0
A collection of Prefect Tasks for memory profiling in Prefect 1.0.

## Getting Started

### Python setup

Requires an installation of Python 3.7+.

We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.
We recommend using a Python virtual environment manager such as `pipenv`, `conda` or `virtualenv`.

These tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the [Prefect documentation](https://orion-docs.prefect.io/).
For more information about how to use Prefect, please refer to the [Prefect documentation](https://docs.prefect.io/).

### Installation

Expand All @@ -25,19 +25,22 @@ pip install prefect-memory-profiling
### Write and run a flow

```python
from prefect import flow
from prefect_memory_profiling.tasks import (
goodbye_prefect_memory_profiling,
hello_prefect_memory_profiling,
)


@flow
def example_flow():
hello_prefect_memory_profiling
goodbye_prefect_memory_profiling

example_flow()
from prefect import Flow
from prefect_memory_profiling.tasks import profiled_task

@profiled_task(name='My Profiled Task', stream=open('logfile.txt', 'a+'))
def resource_intensive_task(n: int = 100):
a = [n**n for n in range(2*n)]
b = [n**n for n in range(4*n)]
c = [n**n for n in range(n**2)]

return sum(a + b + c)

with Flow('Memory Profiled Flow') as flow:
resource_intensive_task()

if __name__ == "__main__":
flow.run(run_on_schedule=False)
```

## Resources
Expand Down
26 changes: 0 additions & 26 deletions tests/test_tasks.py

This file was deleted.

0 comments on commit d5dadab

Please sign in to comment.