Skip to content

Unexpected path attr set for SmartSim entities when passing an Optional path param  #556

Open
@MattToast

Description

@MattToast

Description

Currently the path parameter to the __init__ methods of Ensemble/Model/Orchestrator are type hinted as so (or equivalent):

def __init__(
    self,
    ...
    path: str | None = os.getcwd(),
    ...
) -> None:

However, if a user were to exercise the Optional type of path, an invalid path of the string "None" is set on the object, effectively leaving the object in an invalid state that cannot be launched.

How to reproduce

Consider the following repl

>>> from smartsim.database.orchestrator import Orchestrator
>>> from smartsim.entity.ensemble import Ensemble
>>> from smartsim.entity.model import Model
>>> from smartsim.settings import RunSettings
>>>
>>> Orchestrator(path=None).path
'None'
>>> rs = RunSettings("echo", ["hello", "world"])
>>> Ensemble("test-ens", {}, path=None, run_settings=rs, replicas=1).path
'None'
>>> Model("test-model", {}, rs, path=None).path
'None'

Expected behavior

The path should not be set to the string "None", but should instead be set to the current working directory. Whether that is the current working directory of at "compile time" or at "run time" remains to be decided.

Alternatively, we could have the path parameter not have a default value.

System

Any/All

Acceptance Criteria

  • Decide on if/what the default path for an Model/Ensemble/Orchestrator should be
  • Passing a path=None param to Model/Ensemble/Orchestrator results in a "valid" path, or disallowed entirely
  • If a default path is agreed upon, add tests to ensure that when path=None is specified the correct default path is set

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: apiIssues related to API changesbug: minorA minor buggood first issueIssue that is ideal for first-time contributorsshort taskIssues that can be completed and reviewed quickly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions