Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Error when inputs have the same filename #588

Closed
nhammond opened this issue Jun 5, 2019 · 2 comments
Closed

Error when inputs have the same filename #588

nhammond opened this issue Jun 5, 2019 · 2 comments

Comments

@nhammond
Copy link
Collaborator

nhammond commented Jun 5, 2019

Using the "hello_world" example, if you run "loom run start hello_world_step hello_cap=hello.txt world_cap=hello.txt punctuation=_", you will see this runtime error:

Copying inputs failed because file already exists. Are there multiple inputs with the same name? loomengine_utils.exceptions.FileAlreadyExistsError: File already exists at /Users/nhammond/loomdata/tmp/7db0ef03-7abd-4259-bf55-7bc349d53d09/work/hello.txt

@nhammond
Copy link
Collaborator Author

nhammond commented Jun 5, 2019

Options to consider for handling this issue:

  1. Keep the error as it is now, so users cannot have multiple inputs with the same name.
  2. Change the name when there is a conflict.
  3. Give users a "save_as" option to change the filename.

We have a user running into this issue where he wants to give the same file twice as separate inputs. The only workaround is to copy the file and change the name on one copy, which is a terrible hack. 1. is not a good option.

There is precedent for 2. We already do this for array inputs. If you look at the "word_pairs" example you see matching filenames in an array are given an index, i.e. "cat word_pair__0__.txt word_pair__1__.txt word_pair__2__.txt word_pair__3__.txt word_pair__4__.txt word_pair__5__.txt > all_word_pairs.txt". An advantage to this format is that it reduces the chance of silent failure where a user hard-codes the filename "word_pair.txt" without realizing that it refers to the wrong file. They will be forced to use {{channel_name}} notation in order to get the right filename. We would need to extend the indexing logic to apply simultaneously to all inputs instead of indexing each array input separately.

"save_as" gives control to the user and avoids any magic. But it requires them to write a new template to accommodate a certain set of inputs.

I am leaning towards 2.

@nhammond
Copy link
Collaborator Author

Fixed in #590

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant