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

Feature/connection dataset #116

Merged
merged 4 commits into from
Apr 26, 2020
Merged

Feature/connection dataset #116

merged 4 commits into from
Apr 26, 2020

Conversation

jefferis
Copy link
Contributor

@jefferis jefferis commented Apr 25, 2020

@romainFr do you want to take a quick look at this? It means that you can specify a default dataset for a connection. I think this will make it easier to use two connections at the same time (e.g. test and public servers). However it also now makes it an error to have a bad dataset specification (rather than just ignoring it).

@romainFr
Copy link
Collaborator

Thanks @jefferis , that looks very useful. I'm getting some odd behavior when switching back and forth which I believe might have to do with caching. Let's say I have two connection objects,

newConnection <- neuprint_connection()

oldConnection <- neuprint_connection(server="https://emd.../",token = "e...k",config=httr::config(ssl_verifypeer=0L),dataset="hemibrain:vXX")

test2 <- neuprint_queryXXX()
## Results from newConnection

test2 <- neuprint_queryXXX(conn=oldConnection)
## Results from oldConnection

test2 <- neuprint_queryXXX()
## Results from oldConnection

test2 <- neuprint_queryXXX(conn=newConnection)
## Results from newConnection

###### SUPRISING TO ME
test2 <- neuprint_queryXXX()
## Results from oldConnection : it does not switch back to newConnection

In other words, the default does not switch more than once, I see the same behavior when trying to switch with neuprint_login. Am I misunderstanding the expected behavior?

@jefferis
Copy link
Contributor Author

The default is currently to use the last connection added to the connection cache when none is specified. Connections are added to the connection cache when logging in to the server for the first time. Therefore what you see is the expected behaviour right now.

To be honest, the only 100% reliable way to deal with two (or more servers) is to make connection objects to both and specify them explicitly for each query.

conn1=neuprint_login('https://first.com')
conn2=neuprint_login('https://other.com')

Anything else relies strongly on the order of operations. You can make the order a bit safer by doing Force=T when you make the connections since this will cause server login to happen and ensure that they are (re)-added to the connection cache.

@romainFr
Copy link
Collaborator

Ah yes, that makes sense. It's ready for merge from my perspective (except that rhubarb should never trigger errors!).

@jefferis
Copy link
Contributor Author

OK. Thanks @romainFr! Just a note that neuprint_connection makes a connection but does not login. neuprint_login does that. So if you do want to be sure about the order in which connections are added to the cache you may want to do

newConnection <- neuprint_login(Force=T)
oldConnection <- neuprint_login(server="https://emd.../",token = "e...k",config=httr::config(ssl_verifypeer=0L),dataset="hemibrain:vXX", Force=T)

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

Successfully merging this pull request may close these issues.

2 participants