π Cheatsheet
π Cheatsheet
A quick reference guide for common FlowyML commands, patterns, and recipes. Bookmark this page for instant access to the syntax you need.
π» CLI π Python API π― Patterns
CLI Commands π»
Project Management
# Initialize a new project
flowyml init my-project
# Initialize with a specific template
flowyml init my-project --template basic
UI Management
# Start the UI server
flowyml ui start
# Stop the UI server
flowyml ui stop
# Check UI status
flowyml ui status
Pipeline Execution
# Run a pipeline script
python my_pipeline.py
# Run with specific configuration
FLOWYML_ENV=production python my_pipeline.py
Cache Management
# Clear all cache
flowyml cache clear
# Clear cache for specific pipeline
flowyml cache clear --pipeline my_pipeline
Python API π
Basic Pipeline
from flowyml import Pipeline, step
@step(outputs=["data"])
def step_one():
return "data"
@step(inputs=["data"])
def step_two(data):
return f"processed {data}"
# Create and run pipeline
pipeline = Pipeline("my_pipeline")
pipeline.add_step(step_one)
pipeline.add_step(step_two)
result = pipeline.run()
Explicit Pipeline Construction
from flowyml import Pipeline, step
p = Pipeline("explicit_pipeline")
p.add_step(step_one)
p.add_step(step_two)
p.run()
Step Configuration
@step(
inputs=["raw_data"], # Input asset names
outputs=["model"], # Output asset names
cache="code_hash", # Caching strategy
retry=3, # Retry attempts
timeout=3600, # Timeout in seconds
resources={"gpu": 1} # Resource requirements
)
def train(raw_data):
...
Context & Parameters
from flowyml import context, pipeline
# Define context with parameters
ctx = context(
learning_rate=0.01,
batch_size=32,
env="dev"
)
@step
def train(learning_rate, batch_size):
# Parameters are auto-injected by name!
...
@pipeline(context=ctx)
def train_pipeline():
return train()
Assets
from flowyml import Dataset, Model, Metrics
# Create a dataset
ds = Dataset.create(
data=df,
name="training_data",
properties={"source": "s3://..."}
)
# Create metrics
metrics = Metrics.create(
accuracy=0.95,
loss=0.02
)
Directory Structure π
my-project/
βββ flowyml.yaml # Project configuration
βββ .flowyml/ # Internal storage
β βββ artifacts/ # Stored assets
β βββ cache/ # Execution cache
β βββ runs/ # Run metadata
βββ src/ # Source code
β βββ pipelines/ # Pipeline definitions
βββ notebooks/ # Jupyter notebooks
Evaluations π―
from flowyml import step, evaluate
from flowyml.evaluations import accuracy, precision, f1_score
@step(inputs=["model", "test_data"], outputs=["eval_results"])
def evaluate_model(model, test_data):
results = evaluate(
model=model,
data=test_data,
scorers=[accuracy, precision, f1_score],
quality_gate={"accuracy": 0.9} # Fail if below
)
return results
Scheduling β°
# Schedule from CLI
flowyml schedule add --pipeline my_pipeline \
--cron "0 6 * * *" \
--name "Daily Training"
# List schedules
flowyml schedule list
# Remove schedule
flowyml schedule remove --name "Daily Training"
Stack Switching βοΈ
# Development (local)
export FLOWYML_STACK=local
# Production (cloud)
export FLOWYML_STACK=production
# Same code, different infrastructure
python my_pipeline.py