From 80df3c92bdb5dbd27842ec63e9252cc1eeac7beb Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 17 Nov 2022 12:07:13 +0100 Subject: [PATCH] fix initial python script --- frontend/src/lib/script_helpers.ts | 9 ++++----- frontend/src/routes/run/[...run].svelte | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/src/lib/script_helpers.ts b/frontend/src/lib/script_helpers.ts index ec26b83303..f4cc257d61 100644 --- a/frontend/src/lib/script_helpers.ts +++ b/frontend/src/lib/script_helpers.ts @@ -1,7 +1,7 @@ import type { Script } from "./gen" export const PYTHON_INIT_CODE = `import os -from wmill import * +import wmill """ Use Cmd/Ctrl + S to autoformat the code. @@ -14,17 +14,16 @@ def main(no_default: str, age = 42, obj: dict = {"even": "dicts"}, l: list = ["or", "lists!"], - file_: bytes = bytes(0), - db: Resource["postgresql"] = "g/all/demodb"): + file_: bytes = bytes(0)): """A main function is required for the script to be able to accept arguments. Types are recommended.""" print(f"Hello World and a warm welcome especially to {name}") - print("and its acolytes..", age, obj, l, len(file_), dtime) + print("and its acolytes..", age, obj, l, len(file_)) # retrieve variables, including secrets by querying the windmill platform. # secret fetching is audited by windmill. try: - secret = get_variable("g/all/pretty_secret") + secret = wmill.get_variable("g/all/pretty_secret") except: secret = "No secret yet at g/all/pretty_secret!" diff --git a/frontend/src/routes/run/[...run].svelte b/frontend/src/routes/run/[...run].svelte index ee844e76a2..bfa4b4f63a 100644 --- a/frontend/src/routes/run/[...run].svelte +++ b/frontend/src/routes/run/[...run].svelte @@ -125,7 +125,7 @@ layout={[0.75, [2, 0, 2], 2.25, [{ h: 1.5, w: 40 }]]} /> {#if job?.job_kind === 'script' || job?.job_kind === 'flow'} - + {@const isScript = job?.job_kind === 'script'} {@const runsHref = `/runs/${job?.script_path}${!isScript ? '?jobKind=flow' : ''}`}