Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repos:
rev: v2.9.0
hooks:
- id: pip-audit
args: ['--ignore-vuln', 'GHSA-4xh5-x5gv-qwph', '--ignore-vuln', 'GHSA-6vgw-5pg2-w6jp']
args: ['--ignore-vuln', 'GHSA-4xh5-x5gv-qwph', '--ignore-vuln', 'GHSA-6vgw-5pg2-w6jp', '--ignore-vuln', 'GHSA-5239-wwwm-4pmq', '--ignore-vuln', 'GHSA-gc5v-m9x4-r6x2']

# Check for large files that shouldn't be committed
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
10 changes: 5 additions & 5 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ environments.forEach(env => {

// Ensure runtime (creates or reuses existing)
const runtime = await client.ensureRuntime(
'python-cpu-env', // environment name
'ai-agents-env', // environment name
50, // credits limit
true, // wait for ready
60000, // max wait time (ms)
Expand Down Expand Up @@ -534,7 +534,7 @@ try {
}

// Model deletion state
const runtime = await client.createRuntime('python-cpu-env', 'notebook', 'test', 10);
const runtime = await client.createRuntime('ai-agents-env', 'notebook', 'test', 10);
await client.deleteRuntime(runtime.podName);

// This will throw an error
Expand Down Expand Up @@ -574,15 +574,15 @@ const client = new DatalayerClient({

4. **Wait for runtime readiness**: Always use `waitUntilReady()` after creating a runtime before performing operations:
```typescript
const runtime = await client.createRuntime('python-cpu-env', 'notebook', 'analysis', 50);
const runtime = await client.createRuntime('ai-agents-env', 'notebook', 'analysis', 50);
await runtime.waitUntilReady(60000); // Wait up to 60 seconds
// Now safe to use runtime
```

5. **Reuse runtimes when possible**: Use `ensureRuntime()` instead of `createRuntime()` to reuse existing runtimes and save credits:
```typescript
const runtime = await client.ensureRuntime(
'python-cpu-env',
'ai-agents-env',
50, // credits limit
true, // wait for ready
60000, // max wait time
Expand Down Expand Up @@ -671,7 +671,7 @@ if (testConfig.hasToken()) {
// Skip expensive tests if configured
if (!testConfig.shouldSkipExpensive()) {
// Run expensive tests (runtime creation, etc.)
const runtime = await client.createRuntime('python-cpu-env', 'notebook', 'test', 10);
const runtime = await client.createRuntime('ai-agents-env', 'notebook', 'test', 10);
await client.deleteRuntime(runtime.podName);
}
```
Expand Down
2 changes: 1 addition & 1 deletion datalayer_core/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

"""Datalayer Core version information."""

__version__ = "1.1.18"
__version__ = "1.1.19"
4 changes: 3 additions & 1 deletion datalayer_core/base/user_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def set_runtimes_url(url: str) -> None:
_save_config(config)


def set_config(iam_url: Optional[str] = None, runtimes_url: Optional[str] = None) -> None:
def set_config(
iam_url: Optional[str] = None, runtimes_url: Optional[str] = None
) -> None:
"""
Set multiple config values at once.

Expand Down
7 changes: 5 additions & 2 deletions datalayer_core/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@
from datalayer_core.cli.commands.envs import app as envs_app
from datalayer_core.cli.commands.envs import envs_list, envs_ls
from datalayer_core.cli.commands.exec import main as exec_main
from datalayer_core.cli.commands.otel import app as otel_app
from datalayer_core.cli.commands.runtime_checkpoints import app as checkpoints_app
from datalayer_core.cli.commands.runtime_checkpoints import checkpoints_list, checkpoints_ls
from datalayer_core.cli.commands.runtime_checkpoints import (
checkpoints_list,
checkpoints_ls,
)
from datalayer_core.cli.commands.runtime_snapshots import app as snapshots_app
from datalayer_core.cli.commands.runtime_snapshots import snapshots_list, snapshots_ls
from datalayer_core.cli.commands.runtimes import app as runtimes_app
from datalayer_core.cli.commands.runtimes import runtimes_list, runtimes_ls
from datalayer_core.cli.commands.secrets import app as secrets_app
from datalayer_core.cli.commands.secrets import secrets_list, secrets_ls
from datalayer_core.cli.commands.otel import app as otel_app
from datalayer_core.cli.commands.tokens import app as tokens_app
from datalayer_core.cli.commands.tokens import tokens_list, tokens_ls
from datalayer_core.cli.commands.usage import app as usage_app
Expand Down
6 changes: 4 additions & 2 deletions datalayer_core/cli/commands/authn.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
from datalayer_core.utils.urls import DatalayerURLs

# Create a Typer app for auth commands
app = typer.Typer(name="auth", help="Authentication commands", invoke_without_command=True)
app = typer.Typer(
name="auth", help="Authentication commands", invoke_without_command=True
)

console = Console()


@app.callback()
def auth_callback(ctx: typer.Context):
def auth_callback(ctx: typer.Context) -> None:
"""Authentication commands."""
if ctx.invoked_subcommand is None:
typer.echo(ctx.get_help())
Expand Down
10 changes: 7 additions & 3 deletions datalayer_core/cli/commands/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@
from datalayer_core.utils.urls import DatalayerURLs

# Create a Typer app for benchmarks commands
app = typer.Typer(name="benchmarks", help="Benchmarks management commands", invoke_without_command=True)
app = typer.Typer(
name="benchmarks",
help="Benchmarks management commands",
invoke_without_command=True,
)

console = Console()


@app.callback()
def benchmarks_callback(ctx: typer.Context):
"""Benchmarks management commands."""
def benchmarks_callback(ctx: typer.Context) -> None:
"""Manage benchmark commands."""
if ctx.invoked_subcommand is None:
typer.echo(ctx.get_help())

Expand Down
6 changes: 4 additions & 2 deletions datalayer_core/cli/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
from rich.table import Table

from datalayer_core.base.user_config import (
CONFIG_FILE,
DEFAULT_IAM_URL,
DEFAULT_RUNTIMES_URL,
get_config,
get_iam_url,
get_runtimes_url,
set_config,
CONFIG_FILE,
)

# Create a Typer app for the config command
Expand Down Expand Up @@ -70,7 +70,9 @@ def set_values(
) -> None:
"""Set configuration values non-interactively."""
if iam_url is None and runtimes_url is None:
console.print("[yellow]No values to set. Use --iam-url and/or --runtimes-url.[/yellow]")
console.print(
"[yellow]No values to set. Use --iam-url and/or --runtimes-url.[/yellow]"
)
raise typer.Exit(1)

set_config(iam_url=iam_url, runtimes_url=runtimes_url)
Expand Down
8 changes: 5 additions & 3 deletions datalayer_core/cli/commands/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
from datalayer_core.utils.urls import DatalayerURLs

# Create a Typer app for console commands
app = typer.Typer(name="console", help="Runtime console commands", invoke_without_command=True)
app = typer.Typer(
name="console", help="Runtime console commands", invoke_without_command=True
)

console = Console()


@app.callback()
def console_callback(ctx: typer.Context):
def console_callback(ctx: typer.Context) -> None:
"""Runtime console commands."""
if ctx.invoked_subcommand is None:
typer.echo(ctx.get_help())
Expand Down Expand Up @@ -128,7 +130,7 @@ def console_connect(

# For backward compatibility, make connect the default command
@app.callback(invoke_without_command=True)
def console_callback(
def console_callback_default(
ctx: typer.Context,
runtime_name: Optional[str] = typer.Option(
None,
Expand Down
6 changes: 4 additions & 2 deletions datalayer_core/cli/commands/envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
from datalayer_core.utils.urls import DatalayerURLs

# Create a Typer app for environment commands
app = typer.Typer(name="envs", help="Environment management commands", invoke_without_command=True)
app = typer.Typer(
name="envs", help="Environment management commands", invoke_without_command=True
)

console = Console()

Expand All @@ -28,7 +30,7 @@ def _make_client(


@app.callback()
def envs_callback(ctx: typer.Context):
def envs_callback(ctx: typer.Context) -> None:
"""Environment management commands."""
if ctx.invoked_subcommand is None:
typer.echo(ctx.get_help())
Expand Down
18 changes: 9 additions & 9 deletions datalayer_core/cli/commands/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
from datalayer_core.utils.notebook import get_cells

# Create the main Typer app for exec functionality
app = typer.Typer(name="exec", help="Execute files or notebooks on runtimes", invoke_without_command=True)
app = typer.Typer(
name="exec",
help="Execute files or notebooks on runtimes",
invoke_without_command=True,
)

console = Console()


@app.callback()
def exec_callback(ctx: typer.Context):
def exec_callback(ctx: typer.Context) -> None:
"""Execute files or notebooks on runtimes."""
if ctx.invoked_subcommand is None:
typer.echo(ctx.get_help())
Expand Down Expand Up @@ -315,13 +319,9 @@ def _select_runtime(token: Optional[str] = None) -> str:
runtimes = client.list_runtimes()

if not runtimes:
# No runtimes available, prompt to create one
console.print("[yellow]No runtimes are currently available.[/yellow]")
console.print("[blue]You can create a runtime using:[/blue]")
console.print(" [cyan]dla runtimes create <environment>[/cyan]")
console.print("\n[blue]Or list available environments with:[/blue]")
console.print(" [cyan]dla envs list[/cyan]")
raise typer.Exit(1)
# Return an empty runtime name to trigger RuntimeManager's built-in
# interactive flow that can launch a runtime from an environment.
return ""

# Use the first available runtime
selected = runtimes[0]
Expand Down
Loading
Loading