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

External data files not resolved when preprocessed model placed in sde-prep directory #303

Open
chrispcampbell opened this issue Dec 12, 2022 · 0 comments
Assignees
Labels

Comments

@chrispcampbell
Copy link
Contributor

chrispcampbell commented Dec 12, 2022

Currently the build package uses the sde-prep directory as a "working directory" and writes the preprocessed mdl file (the output of sde generate --preprocess) to that directory. If the mdl file directly references other external data files, then these file references won't work because the mdl file is now at a different level than the data files. For example:

The following is an example of an mdl file and a project directory structure that doesn't currently work:

X = GET DIRECT CONSTANTS('data.csv', ...)
project/
  model-files/
    data.csv
    model.mdl
  sde-prep/
    processed.mdl

The workaround for now is to use one of the config file callbacks to edit the paths so that data.csv is replaced with ../model-files/data.csv.

The ext-control-params integration test is affected by this issue. Here's an example of how to change the config file to apply the above workaround (taken from the sde.config.js file for that test):

    plugins: [
      // XXX: Include a custom plugin that applies post-processing steps.  This is
      // a workaround for issue #303 where external data files can't be resolved.
      {
        postProcessMdl: (_, mdlContent) => {
          return mdlContent.replaceAll('ext-control-params.csv', '../ext-control-params.csv')
        }
      },
      ...
    ]
@chrispcampbell chrispcampbell self-assigned this Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant