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 nextpipe/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "v0.5.0"
__version__ = "v0.6.0"
20 changes: 5 additions & 15 deletions nextpipe/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
from functools import wraps

import nextmv
from nextmv import cloud
from nextmv.deprecated import deprecated

from . import utils
Expand Down Expand Up @@ -749,15 +748,6 @@ def decorator(function):
return decorator


_DEFAULT_POLLING_OPTIONS: cloud.PollingOptions = cloud.PollingOptions()
"""Default polling options to use when polling for a run result.

This variable defines the default polling options used by the `app` decorator
when waiting for the results of a Nextmv Application run. It configures behavior
such as the timeout and backoff strategy.
"""


class App:
"""
Represents an external application step.
Expand All @@ -777,7 +767,7 @@ class App:
Whether to return the full result including metadata.
run_configuration : nextmv.RunConfiguration
The configuration to apply when running the app.
polling_options : Optional[cloud.PollingOptions]
polling_options : Optional[nextmv.PollingOptions]
Options for polling for the results of the app run.
"""

Expand All @@ -790,7 +780,7 @@ def __init__(
options: dict[str, typing.Any] = None,
full_result: bool = False,
run_configuration: nextmv.RunConfiguration = None,
polling_options: cloud.PollingOptions | None = _DEFAULT_POLLING_OPTIONS,
polling_options: nextmv.PollingOptions | None = nextmv.DEFAULT_POLLING_OPTIONS,
):
"""
Initialize an App object.
Expand All @@ -807,7 +797,7 @@ def __init__(
Whether to return the full result including metadata, by default False.
run_configuration : nextmv.RunConfiguration, optional
The configuration to apply when running the app, by default None.
polling_options : Optional[cloud.PollingOptions], optional
polling_options : Optional[nextmv.PollingOptions], optional
Options for polling for the results of the app run, by default _DEFAULT_POLLING_OPTIONS.
"""

Expand Down Expand Up @@ -855,7 +845,7 @@ def app(
input_type: InputType = None,
full_result: bool = False,
run_configuration: nextmv.RunConfiguration = None,
polling_options: cloud.PollingOptions | None = _DEFAULT_POLLING_OPTIONS,
polling_options: nextmv.PollingOptions | None = nextmv.DEFAULT_POLLING_OPTIONS,
):
"""
Decorator to mark a step as a Nextmv Application (external application)
Expand Down Expand Up @@ -888,7 +878,7 @@ def app(
returned.
run_configuration : nextmv.RunConfiguration
The configuration to apply when running the app.
polling_options : Optional[cloud.PollingOptions]
polling_options : Optional[nextmv.PollingOptions]
Options for polling for the results of the app run. This is used to
configure the polling behavior, such as the timeout and backoff
options. Default (or when undefined) is the predefined options in the
Expand Down
7 changes: 4 additions & 3 deletions nextpipe/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
from itertools import product
from typing import Any

from nextmv.cloud import Application, Client, RunResult
import nextmv
from nextmv.cloud import Application, Client

from . import config, decorators, graph, schema, threads, uplink, utils
from .__about__ import __version__
Expand Down Expand Up @@ -926,9 +927,9 @@ def __run_step(node: FlowNode, inputs: list[object], client: Client) -> list[obj
# Merge the options from the app decorator with the options from the
# AppRunConfig. AppRunConfig options take precedence.
options = app_step.options | app_run_options
elif isinstance(inputs[0], RunResult):
elif isinstance(inputs[0], nextmv.RunResult):
# If the input is a RunResult, we use its output as input.
run_result: RunResult = inputs[0]
run_result: nextmv.RunResult = inputs[0]
input = run_result.output
options = app_step.options
name = node.id
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classifiers = [
]
dependencies = [
"requests>=2.31.0",
"nextmv>=0.37.2",
"nextmv>=0.40.0",
"dataclasses-json>=0.6.7",
]
description = "Framework for Decision Pipeline modeling and execution"
Expand Down
4 changes: 2 additions & 2 deletions tests/pipelines/multifile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def transform(result_path: str):
)
@needs(predecessors=[transform])
@step
def solve2(result: nextmv.cloud.RunResult):
def solve2(result: nextmv.RunResult):
"""Runs another multi-file model."""
pass

Expand All @@ -68,7 +68,7 @@ def solve2(result: nextmv.cloud.RunResult):
# via 'result.output'.
@needs(predecessors=[solve2])
@step
def prepare_output(result: nextmv.cloud.RunResult):
def prepare_output(result: nextmv.RunResult):
"""Transforms the result for the next step."""
# Extract the path to the output files.
result_path = result.output
Expand Down
3 changes: 2 additions & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import unittest

import goldie
import nextmv
from nextmv import cloud

# Add the parent directory to the sys.path to allow imports from the main package. This
Expand Down Expand Up @@ -50,7 +51,7 @@ def test_platform(self):

# Run the app
r = random.randint(0, 100)
polling_opts = cloud.PollingOptions(max_tries=500, max_duration=240)
polling_opts = nextmv.PollingOptions(max_tries=500, max_duration=240)
result = app.new_run_with_result(input={"random": r}, polling_options=polling_opts)
self.assertTrue(hasattr(result, "error_log") and result.error_log is None)
self.assertEqual(result.output["echo"]["data"]["enhanced"], True)
Expand Down