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

Run 'haros init' in the build dir (instead of $HOME) #6

Closed
gavanderhoorn opened this issue Apr 22, 2019 · 22 comments
Closed

Run 'haros init' in the build dir (instead of $HOME) #6

gavanderhoorn opened this issue Apr 22, 2019 · 22 comments
Labels
enhancement New feature or request

Comments

@gavanderhoorn
Copy link
Member

Current implementation appears to run haros init without any special configuration, which would place all haros configuration and plugin meta-data in $HOME of the current user.

Perhaps OK for normal usage, but it might be better to not do that when run as part of a catkin_make run_tests run to avoid polluting a user's $HOME and/or any existing haros installation.

It's unclear whether haros init actually accepts alternative locations -- and whether "the rest" of haros accepts non-standard locations -- but that would be something to investigate.

@gavanderhoorn gavanderhoorn added the enhancement New feature or request label Apr 22, 2019
@gavanderhoorn
Copy link
Member Author

gavanderhoorn commented Jun 14, 2019

@git-afsantos: would Haros support storing everything in a directory not in $HOME/.haros?

I'm guessing the HarosInitRunner would need to be changed?

@git-afsantos
Copy link

Indeed, to support alternative directories I would have to make some changes. The single directory approach is something that has been bothering me too for a while.

I am currently fixing some other issues in Haros, so I might tackle this right after.

@gavanderhoorn
Copy link
Member Author

I don't necessarily just want to dump this on your TODO list.

Do you have some ideas for what you'd like to change?

The init runner seems straightforward enough. Adding an additional arg to the init verb would probably be sufficient, correct?

All the other verbs would probably also need to be extended to accept an additional arg telling them where the ".haros"-dir is (which wouldn't necessarily be called that any more).

@git-afsantos
Copy link

Since this change affects all verbs, it is probably best for the argument to be passed to the haros command itself (like --debug is). I.e.,

haros --home /my/new/haros/dir <VERB> <ARGS>

In terms of the code itself, the argument would be introduced around this line, with the default value of os.path.join(os.path.expanduser("~"), ".haros").

Then each verb runner (init, analyse, export, viz) would find & replace self.HAROS_DIR with args.home (args.root, args.haros_dir, or whatever it is called).

@git-afsantos
Copy link

@git-afsantos
Copy link

@gavanderhoorn is your suggestion to place .haros somewhere else besides $HOME, or to use some other directory in place of .haros? I.e., /path/to/.haros versus /just/some/path?

The latter requires a little bit more work to implement.

@git-afsantos
Copy link

git-afsantos commented Jun 14, 2019

git-afsantos/haros#71 is a candidate PR to implement this.
It implements the easier create .haros in the given dir option.

@gavanderhoorn
Copy link
Member Author

is your suggestion to place .haros somewhere else besides $HOME, or to use some other directory in place of .haros? I.e., /path/to/.haros versus /just/some/path?

the latter.

But the former could be a work-around for now.

@git-afsantos
Copy link

git-afsantos commented Jun 15, 2019

git-afsantos/haros#71 has been updated. The directory given to --home will be used directly in place of ~/.haros.

Additionally, init is not needed anymore, unless you want to force the expected structure of .haros (i.e., overwrite files if needed). I will probably deprecate and remove this verb at some point.


Released in Haros 3.5.0.
BTW, this is yet untested, but I suspect that with different --homes Haros can now run multiple instances in parallel. Is this your intended use?

@gavanderhoorn
Copy link
Member Author

BTW, this is yet untested, but I suspect that with different --homes Haros can now run multiple instances in parallel. Is this your intended use?

As I mentioned in the meeting we just had: this wasn't directly related to running multiple Haros instances in parallel, but it should make it possible, yes, and that is actually going to help quite a bit later on.

Primary motivation was to be able to put the .haros dir in the build space of a workspace so we don't accidentally reuse a .haros from another run.

@gavanderhoorn
Copy link
Member Author

gavanderhoorn commented Jun 24, 2019

@git-afsantos: I'm using Haros with git-afsantos/haros#71 (ie: v3.5.2) and the initial init seems to work.

But a subsequent analyse throws errors:

$ rosrun haros_catkin haros --home=/tmp/ws/build_isolated/test_pkg/haros_home -c /tmp/ws/src/haros_catkin_test/test_pkg analyse -d /tmp/ws/build_isolated/test_pkg/test_results/haros_report
Traceback (most recent call last):
  File "/tmp/ws/devel_isolated/haros_catkin/share/haros_catkin/venv/bin/haros", line 10, in <module>
    sys.exit(main())
  File "/tmp/ws/devel_isolated/haros_catkin/share/haros_catkin/venv/lib/python2.7/site-packages/haros/haros.py", line 764, in main
    if launcher.launch(argv = argv):
  File "/tmp/ws/devel_isolated/haros_catkin/share/haros_catkin/venv/lib/python2.7/site-packages/haros/haros.py", line 149, in launch
    return args.command(args)
  File "/tmp/ws/devel_isolated/haros_catkin/share/haros_catkin/venv/lib/python2.7/site-packages/haros/haros.py", line 178, in command_analyse
    raise ValueError("Not a file: " + args.package_index)
AttributeError: 'Namespace' object has no attribute 'package_index'

all directories exist and /tmp/ws/build_isolated/test_pkg/haros_home seems to contain the expected content.

Any ideas?

PS: would you want me to open an issue on the haros tracker?

@git-afsantos
Copy link

Wow, you ran into two bugs at once! Good catch!

So, basically, it was looking for the default $HOME/.haros/index.yaml, despite the use of --home.
Haros 3.5.4 🚢 should fix that. 🐛 🔨

@gavanderhoorn
Copy link
Member Author

Nice. I'll test. Thanks for the quick fixes.

Btw, I noticed that the github repo releases page doesn't appear to list all releases that pypi has. Is that intentional?

@git-afsantos
Copy link

That is just me remembering the existence of that page only when I have a somewhat major release on my hands. Thanks for the reminder, I should update it sometime soon. 👍

@gavanderhoorn
Copy link
Member Author

Seems to work now, but I'm seeing [HAROS] Running setup operations... twice.

Afaict I init the same directory as I use for --home. Is init automatically invoked by the other verbs/commands?

@git-afsantos
Copy link

Yes, when I added the --home option, init basically became obsolete. You should not need it, unless you want to force a reset on the directory.

@gavanderhoorn
Copy link
Member Author

I'm not entirely sure yet, but I believe not running init separately results in another traceback.

I'll verify and report back.

@git-afsantos
Copy link

git-afsantos commented Jun 25, 2019

Ah, I see. Given your command above, it is probably complaining with

ValueError: Not a file: /tmp/ws/build_isolated/test_pkg/haros_home/index.yaml

I should be able to fix that soon.

@gavanderhoorn
Copy link
Member Author

Yes, indeed. That's the error:

Traceback (most recent call last):
  File "/tmp/ws/devel_isolated/haros_catkin/share/haros_catkin/venv/bin/haros", line 10, in <module>
    sys.exit(main())
  File "/tmp/ws/devel_isolated/haros_catkin/share/haros_catkin/venv/lib/python2.7/site-packages/haros/haros.py", line 763, in main
    if launcher.launch(argv = argv):
  File "/tmp/ws/devel_isolated/haros_catkin/share/haros_catkin/venv/lib/python2.7/site-packages/haros/haros.py", line 149, in launch
    return args.command(args)
  File "/tmp/ws/devel_isolated/haros_catkin/share/haros_catkin/venv/lib/python2.7/site-packages/haros/haros.py", line 179, in command_analyse
    raise ValueError("Not a file: " + project_file)
ValueError: Not a file: /tmp/ws/build_isolated/test_pkg/haros_home/index.yaml

@git-afsantos
Copy link

Haros 3.5.5 should fix that 🚢

@gavanderhoorn
Copy link
Member Author

Yep, fixed.

Thanks again.

@gavanderhoorn
Copy link
Member Author

This is now supported in Haros, and we can configure it in haros_catkin now that #19 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants