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

droplet_create can't generate a random name without library(analogsea) #125

Closed
trestletech opened this issue Apr 22, 2017 · 9 comments
Closed
Labels
Milestone

Comments

@trestletech
Copy link

I'm a bit rusty on my R package import lifetime, so pardon me for not being of more help with a suggested fix here, but...

If I attempt to use analogsea without first library()ing it, most things seem to work, however generating a random name for an image does not because of failures in the random name generation.

> analogsea::droplet_create()
Using default ssh keys: trestle-secure-rsa
Error in sample(x, size = 1) : object 'adjectives' not found
> adjectives <- c("red", "blue")
> analogsea::droplet_create()
Using default ssh keys: trestle-secure-rsa
Error in sample(x, size = 1) : object 'nouns' not found
> nouns <- c("horse", "canary")
> analogsea::droplet_create()
Using default ssh keys: mySSHKey
NB: This costs $0.00744 / hour until you droplet_delete() it
Waiting for create ..

It looks like the adjectives and nouns variables need to be made available earlier in the package lifetime in order to be used by these functions.

The more obvious workaround to the one above is just to call library(analogsea) which makes those datasets available and then everything just works out the box like you'd expect.

I'm not sure what impact this would have on packages that want to import analogsea, but I suspect I'll find out momentarily! ;)

@sckott
Copy link
Collaborator

sckott commented Apr 25, 2017

Thanks for the issue @trestletech

Not sure what the right answer is here, but what about loading the datasets in onLoad?

Made the change in https://github.com/sckott/analogsea/tree/datasets branch - thoughts?

sckott added a commit that referenced this issue Apr 25, 2017
@trestletech
Copy link
Author

Hm... I may have not restarted my session properly, but I'm not getting

> analogsea::droplet_create()
Using default ssh keys: trestle-secure-rsa
Error in sample(x, size = 1) : object 'adjectives' not found
In addition: Warning messages:
1: In utils::data("words") : data set ‘words’ not found
2: In utils::data("adjectives") : data set ‘adjectives’ not found
3: In utils::data("nouns") : data set ‘nouns’ not found
> 

unfortunately, I'd have to brush up on my R package loading details before I'd be qualified to give a meaningful code review here. Just trying to test empirically.

It's entirely possible that the above message is user error, so feel free to disregard if you think your branch fixes things.

@sckott
Copy link
Collaborator

sckott commented Apr 26, 2017

you did install from datasets branch?

@trestletech
Copy link
Author

I did, indeed. And then I restarted the R session and that was the result I got. This is, of course, without having analogsea library()'d or otherwise loaded.

@sckott
Copy link
Collaborator

sckott commented Apr 27, 2017

okay, i'll take another look at that branch

@sckott
Copy link
Collaborator

sckott commented Apr 27, 2017

can you try again after reinstalling from datasets - moved the data sets into the package in an R file as vectors. still works for me, but question is does work for you

@trestletech
Copy link
Author

Perfect! Had to downgrade openssl to get around #126 but once I did that I was able to run the following just fine:

> devtools::install_github("sckott/analogsea", ref="datasets")
> analogsea::droplet_create()

@sckott
Copy link
Collaborator

sckott commented Apr 27, 2017

great!

@sckott
Copy link
Collaborator

sckott commented Apr 28, 2017

sorted in b948b19

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

2 participants