Skip to content

Instantly share code, notes, and snippets.

@wild-endeavor
wild-endeavor / a_ux.py
Last active October 12, 2023 13:01
Artifact ux conclusion
# The three options that we were talking about.
# Partitions values will continue to be strings, so they'll be coerced into strings
#
# Option A - Simplest
# This is the closest to the original proposal.
# 1) Declare an instance of Artifact
# | 2) give it a name
# | project&domain added at registration time
# ↓ ↓
my_artifact = Artifact(name="my_data", partitions=["a", "b"], with_time_partition=True)
@wild-endeavor
wild-endeavor / ts.go
Created March 22, 2023 00:09
test for db migrations (flyteadmin #542)
// Before running, create databases legacy and noop;
func TestNoopMigrations(t *testing.T) {
gLogger := gormLogger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), gormLogger.Config{
SlowThreshold: 200 * time.Millisecond,
LogLevel: gormLogger.Info,
IgnoreRecordNotFoundError: false,
Colorful: true,
})
gormConfig := &gorm.Config{
from typing import List
import flytekit.configuration
from flytekit import dynamic, task
from flytekit.configuration import FastSerializationSettings, Image, ImageConfig
from flytekit.core import context_manager
from flytekit.core.context_manager import ExecutionState
from flytekit.core.type_engine import TypeEngine
from flytekitplugins.pod import Pod
from kubernetes.client.models import (
from flytekit import task, workflow
@task
def say_hello(bb: bool) -> str:
if bb:
return "hello bb"
return "hello world"
import typing
from abc import ABC
import numpy as np
import pandas as pd
import pyarrow as pa
from flytekit import kwtypes, task, workflow
from flytekit.types.schema import SchemaFormat
from flytekit.types.structured.structured_dataset import (
@wild-endeavor
wild-endeavor / repa_demo2.py
Created April 7, 2021 17:49
ML repa 2021 Flyte demo 2
from flytekit import task, workflow
@task
def combine_strings(a: str, b: str) -> str:
return f"{a} {b}"
@workflow
def hello_world(wf_in1: str, wf_in2: str) -> str:
@wild-endeavor
wild-endeavor / repa_demo1.py
Created April 7, 2021 17:48
ML repa 2021 Flyte demo 1
def combine_strings(a: str, b: str) -> str:
return f"{a} {b}"
def hello_world(wf_in1: str, wf_in2: str) -> str:
return combine_strings(wf_in1, wf_in2)
if __name__ == "__main__":
print(hello_world("hello", "world"))
@task
def my_task(x: int, y: str) -> bool:
...