Gateway: add on_start functions to stubs
Add on_start function & add env module for determining if we are runn…
…ing locally or remotely (#160)
- Adds an on_start lifecycle method to taskqueues/endpoints
- Adds an is_local method
- Adds a local entrypoint decorator which can be used like this:
```import time
from beta9 import function
from beta9.env import local_entrypoint
def test_func():
return True # this value will be available in some_func
@task_queue(cpu=0.1, on_start=test_func)
def some_func(context):
print(context.task_id)
print(context.on_start_value)
for i in range(1000):
print(i)
time.sleep(0.01)
return "hi"
# This will be executed automatically when running locally (like if __name__ == '__main__')
@local_entrypoint
def main():
print("hi there")
```
---------
Co-authored-by: Luke Lombardi <luke@beam.cloud>