fix initial python script

This commit is contained in:
Ruben Fiszel
2022-11-17 12:07:13 +01:00
parent 18e298f2ad
commit 80df3c92bd
2 changed files with 5 additions and 6 deletions
+4 -5
View File
@@ -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!"
+1 -1
View File
@@ -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'}
<ActionRow applyPageWidth stickToTop>
<ActionRow applyPageWidth>
<svelte:fragment slot="left">
{@const isScript = job?.job_kind === 'script'}
{@const runsHref = `/runs/${job?.script_path}${!isScript ? '?jobKind=flow' : ''}`}