mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-06 16:02:23 +00:00
fix initial python script
This commit is contained in:
@@ -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!"
|
||||
|
||||
|
||||
@@ -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' : ''}`}
|
||||
|
||||
Reference in New Issue
Block a user