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
DM-25030 make an import butler subcommand #293
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay.
# better than hard coding the function names into these conversion | ||
# functions. An extension of the 'cli/resources.yaml' file (as is currently | ||
# used in obs_base) might be a good way to do it. | ||
if functionName == "butler_import": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other option that may be less prone to scaling problems could be to define a dict that maps from "import" to "butler_import" and then automatically generate the inverse dict. Then in these two functions you do the equivalent of:
functionName = funcToCommand.get(functionName, functionName)
(I understand that my dict name there is non-optimal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about making some kind of data structure like that, but if I'm going to do even that much work I wanted to take a moment to figure out the best way to solve the problem. I think it might involve the plugin system, but I didn't want to spent that much time on it or add complexity, yet.
|
||
Parameters | ||
---------- | ||
required : bool, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backticks around the bool
are needed for numpydoc.
|
||
Returns | ||
------- | ||
butler : Butler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backticks on Butler.
directory : `str`, or None | ||
Directory containing dataset files. If `None`, all file paths must be | ||
absolute. | ||
export_file : `str`, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look like an optional parameter in the sense that you don't need to specify it. You do need to specify it but it can be None.
filename=export_file, | ||
transfer=transfer, | ||
format="yaml") | ||
return butler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything using this return parameter. Why does it exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover from trying to fix a unit test issue that ended up not being an issue. Not needed, will remove.
tests/test_cliCmdImport.py
Outdated
case below. | ||
""" | ||
with self.runner.isolated_filesystem(): | ||
f = open("output.yaml", "w") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of opening this file? It doesn't seem to be used anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also leftover from addressing a unit test issue, the fix ended up becoming ExportFileCase. Will remove.
Parameters | ||
---------- | ||
repo : `str` | ||
URI to the location of the repo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URI to the location of the repo or URI to a config file describing the repo and its location.
@@ -84,31 +84,33 @@ def test_loadAndExecutePluginCommand(self): | |||
runner = click.testing.CliRunner() | |||
with command_test_env(runner): | |||
result = runner.invoke(butler.cli, "command-test") | |||
self.assertEqual(result.exit_code, 0, result.output) | |||
self.assertEqual(result.exit_code, 0, f"output: {result.output} exception: {result.exception}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like you have fixed the commands caching so I think that means you can remove the setUp above.
bfb4125
to
6884e08
Compare
tickets/DM-25030-transfer
No description provided.