This change introduces the timecraft.App in the Python SDK. The main idea is to offer a better UX for Python developers and simplify the access to the different Timecraft primitives.
Here is a very simple example of how to compose an application with this framework:
from timecraft import App
import asyncio
import sys
import pickle
app = App()
def read_response(response):
return pickle.loads(response.output.body)
@app.function(name="simpletask")
def sometask(a, b):
return a + b
@app.start()
async def main():
res = sometask.call(40, 2)
while not await res.is_done():
print("waiting...")
await asyncio.sleep(1)
resp = await res.result()
if read_response(resp) != 42:
raise Exception("bad result")
if __name__ == "__main__":
asyncio.run(app.run(sys.argv[1:]))
This change introduces the
timecraft.App
in the Python SDK. The main idea is to offer a better UX for Python developers and simplify the access to the different Timecraft primitives.Here is a very simple example of how to compose an application with this framework: