Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array parameters in model runtime #365

Open
greg-wiltshire opened this issue Apr 25, 2023 · 0 comments
Open

Array parameters in model runtime #365

greg-wiltshire opened this issue Apr 25, 2023 · 0 comments

Comments

@greg-wiltshire
Copy link
Contributor

Bug Report

Steps to Reproduce:

tracdap-runtime 0.5.28

When setting a default value for a parameter which is an array of strings:

string_list_type = trac.TypeDescriptor(trac.BasicType.ARRAY, arrayType=trac.TypeDescriptor(trac.BasicType.STRING))
trac.P("string_list_with_default", string_list_type, label="List of strings with default", default_value=["a", "b", "c"])

and when not setting a default, but setting the value from the local config:

string_list_without_default: ["A", "B", "C"]

Expected Result:

Execution of a model in an IDE runs without error

Actual Result:

The two examples above both cause the separate errors below. First default array values can not be set:

Traceback (most recent call last):
  File "...\tracdap\rt\_impl\models.py", line 196, in scan_model
    parameters = model.define_parameters()
  File "...\test_models\src\testing_models\test_model_a.py", line 45, in define_parameters
    trac.P("string_list_with_default", string_list_type, label="List of strings with default", default_value=["a", "b", "c"]),
  File "...\test_models\venv\lib\site-packages\tracdap\rt\api\static_api.py", line 191, in P
    return declare_parameter(
  File "...\test_models\venv\lib\site-packages\tracdap\rt\api\static_api.py", line 170, in declare_parameter
    return define_parameter(param_name, param_type, label, default_value)
  File "...\test_models\venv\lib\site-packages\tracdap\rt\api\static_api.py", line 148, in define_parameter
    return sa.define_parameter(param_name, param_type, label, default_value)
  File "...\test_models\venv\lib\site-packages\tracdap\rt\_impl\static_api.py", line 85, in define_parameter
    default_value = _type_system.MetadataCodec.encode_value(default_value)
  File "...\test_models\venv\lib\site-packages\tracdap\rt\_impl\type_system.py", line 174, in encode_value
    raise _ex.ETracInternal(f"Value type [{type(value)}] is not supported yet")
tracdap.rt.exceptions.ETracInternal: Value type [<class 'list'>] is not supported yet

Second, values can not be set via local config:

Traceback (most recent call last):
  File "...\testing_models\test_model_a.py", line 100, in <module>
    launch.launch_model(Wrapper, "config/test_models/test_model_a.yaml", "config/sys_config.yaml")
  File "...\test_models\venv\lib\site-packages\tracdap\rt\launch\launch.py", line 91, in launch_model
    job = runtime_instance.load_job_config(_job_config, model_class=model_class)
  File "...\test_models\venv\lib\site-packages\tracdap\rt\_exec\runtime.py", line 256, in load_job_config
    job_config = job_config_parser.parse(job_config_raw, job_config_path)
  File "...\test_models\venv\lib\site-packages\tracdap\rt\_impl\config_parser.py", line 147, in parse
    raise _ex.EConfigParse(message)
tracdap.rt.exceptions.EConfigParse: Errors found in config file [...\test_models\config\test_models\test_model_a.yaml]
Expected type Value, got '['A', 'B', 'C']' (in job.runModel.parameters.string_list_without_default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant