feat(scenarios): added scenario class to sdk#701
Conversation
b4e2996 to
10592f3
Compare
23670ef to
5fe7d00
Compare
… and add metadata tag instead of creating new ones every time (workaround for lack of cleanup option)
10592f3 to
dc8a68e
Compare
james-rl
left a comment
There was a problem hiding this comment.
double-check you committed everything. Other than that i just have some minor doc suggestions
| """Async wrapper around a scenario resource. | ||
|
|
||
| Provides async methods for retrieving scenario details, updating the scenario, | ||
| and starting scenario runs. |
There was a problem hiding this comment.
get rid of the Async wrapper comment. It doesn't add value and it leaks system internals
| """ | ||
|
|
||
| def __init__(self, client: AsyncRunloop, scenario_id: str) -> None: | ||
| """Initialize the wrapper. |
| the underlying devbox, and retrieving scoring results. | ||
|
|
||
| Example: | ||
| >>> scenario = await sdk.scenario.from_id("scn-xxx") |
There was a problem hiding this comment.
you have await here but the method isn't async
| The underlying devbox may still be starting; call await_env_ready() | ||
| on the returned ScenarioRun to wait for it to be ready. | ||
|
|
||
| :param params: See SDKScenarioRunParams for available parameters |
There was a problem hiding this comment.
should be SDKScenarioRunAsyncParams; this is referencing the sync version
| pass | ||
|
|
||
|
|
||
| class TestAsyncScenarioBuilder: |
There was a problem hiding this comment.
I think you might have missed a file. There's a test version of the builders, but I don't see the non-test version of the builder.
…d update docstrings to not leak internals
| self._client.devboxes.await_running(self._devbox_id, polling_config=options.get("polling_config")) | ||
| return self.get_info(**filter_params(options, PollingRequestOptions)) |
There was a problem hiding this comment.
await_env_ready forwards the polling config, but get_info doesn't support it, so the arg will get dropped
* uv lock upgrade * scenario wrapper * modified ScenarioStartRunParams to follow our previous pattern for use in the SDK * fixed redundancy and formatting in scenario and scenario run unit tests * formatting fixes * changed scenario and scenario smoketests to update existing scenarios and add metadata tag instead of creating new ones every time (workaround for lack of cleanup option) * changed scenario run methods to `run` and `run_async`, updated parameter TypedDicts appropriately * exposed all scenario update parameters appropriately using typeddict * formatting fixes * remove scenario builder smoketests * add score_and_complete and download_logs methods to scenario runs, and update docstrings to not leak internals * add unit tests for ScenarioOps and AsyncScenarioOps * update tests for scenario.update and change test name for scenario.run and run_async * add unit tests for download_logs and score_and_complete * don't pass polling_config to get_info within await_env_ready
* chore(smoketests): fixed smoketests and cleaned up typing/formatting (#699) * increase timeout for flaky smoketest * don't convert params from TypedDict to dict (unnecessary and undoes type hints) * docstring formatting fixes * removed shell exec tests with 'working_dir' parameter testing * feat(scenarios): added scenario class to sdk (#701) * uv lock upgrade * scenario wrapper * modified ScenarioStartRunParams to follow our previous pattern for use in the SDK * fixed redundancy and formatting in scenario and scenario run unit tests * formatting fixes * changed scenario and scenario smoketests to update existing scenarios and add metadata tag instead of creating new ones every time (workaround for lack of cleanup option) * changed scenario run methods to `run` and `run_async`, updated parameter TypedDicts appropriately * exposed all scenario update parameters appropriately using typeddict * formatting fixes * remove scenario builder smoketests * add score_and_complete and download_logs methods to scenario runs, and update docstrings to not leak internals * add unit tests for ScenarioOps and AsyncScenarioOps * update tests for scenario.update and change test name for scenario.run and run_async * add unit tests for download_logs and score_and_complete * don't pass polling_config to get_info within await_env_ready * release: 1.1.0 --------- Co-authored-by: sid-rl <siddarth@runloop.ai> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
Thin scenario class wrapper for sdk. Creation will be through a builder pattern (coming soon)