Skip to content
Open
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
15 changes: 12 additions & 3 deletions src/runpod_flash/cli/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from .build_utils.lb_handler_generator import LBHandlerGenerator
from .build_utils.manifest import ManifestBuilder
from .build_utils.resource_config_generator import generate_all_resource_configs
from .build_utils.scanner import RemoteDecoratorScanner
from .build_utils.scanner import RuntimeScanner

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -302,9 +302,16 @@ def run_build(
copy_project_files(files, project_dir, build_dir)

try:
scanner = RemoteDecoratorScanner(build_dir)
scanner = RuntimeScanner(build_dir)
remote_functions = scanner.discover_remote_functions()

if scanner.import_errors:
console.print("\n[red bold]Failed to load:[/red bold]")
for filename, err in scanner.import_errors.items():
console.print(f" [red]{filename}[/red]: {err}")
if not remote_functions:
raise typer.Exit(1)

manifest_builder = ManifestBuilder(
app_name,
remote_functions,
Expand All @@ -326,6 +333,8 @@ def run_build(
deployment_manifest_path = flash_dir / "flash_manifest.json"
shutil.copy2(manifest_path, deployment_manifest_path)

except typer.Exit:
raise
except (ImportError, SyntaxError) as e:
console.print(f"[red]Error:[/red] Code analysis failed: {e}")
logger.exception("Code analysis failed")
Expand Down Expand Up @@ -534,7 +543,7 @@ def validate_project_structure(project_dir: Path) -> bool:
Validate that directory is a Flash project.

A Flash project is any directory containing Python files. The
RemoteDecoratorScanner validates that @remote functions exist.
RuntimeScanner validates that @remote functions exist.

Args:
project_dir: Directory to validate
Expand Down
10 changes: 7 additions & 3 deletions src/runpod_flash/cli/commands/build_utils/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ def __init__(
):
self.project_name = project_name
self.remote_functions = remote_functions
self.scanner = (
scanner # Optional: RemoteDecoratorScanner with resource config info
)
self.scanner = scanner # Optional: RuntimeScanner with resource config info
self.build_dir = build_dir
self.python_version = (
python_version or f"{sys.version_info.major}.{sys.version_info.minor}"
Expand Down Expand Up @@ -205,6 +203,12 @@ def _extract_config_properties(config: Dict[str, Any], resource_config) -> None:
if hasattr(resource_config, "workersMax"):
config["workersMax"] = resource_config.workersMax

if (
hasattr(resource_config, "idleTimeout")
and resource_config.idleTimeout is not None
):
config["idleTimeout"] = resource_config.idleTimeout

if (
hasattr(resource_config, "scalerType")
and resource_config.scalerType is not None
Expand Down
Loading
Loading