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

Issue with retrieving nested objects #374

Closed
1 of 2 tasks
xadahiya opened this issue Mar 24, 2019 · 8 comments
Closed
1 of 2 tasks

Issue with retrieving nested objects #374

xadahiya opened this issue Mar 24, 2019 · 8 comments

Comments

@xadahiya
Copy link
Member

I'm submitting a

  • bug report.
  • feature request.

Current Behaviour:

Retrieving nested objects like

{"@type": "Command", "DroneID": "1223", 
"State": {"@type": "State", "DroneID": "-1000", "Battery": "50", 
"Direction": "North", "Position": "1,1", "Status": "Active", "Speed": "100"}
} 

causes the server to crash.
I guess this happened after the internal mechanism change that was done (Seggrigating nested objects at a different url location). When trying to retrieve any nested object, the server throws this error
[2019-03-24 21:33:05,891] ERROR in app: Exception on /api/CommandCollection/ba49e203-7d00-42d5-92dd-c630873559d0 [GET] Traceback (most recent call last): File "/home/xadahiya/miniconda3/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/home/xadahiya/miniconda3/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/xadahiya/miniconda3/lib/python3.7/site-packages/flask_restful/__init__.py", line 480, in wrapper resp = resource(*args, **kwargs) File "/home/xadahiya/miniconda3/lib/python3.7/site-packages/flask/views.py", line 88, in view return self.dispatch_request(*args, **kwargs) File "/home/xadahiya/miniconda3/lib/python3.7/site-packages/flask_restful/__init__.py", line 595, in dispatch_request resp = meth(*args, **kwargs) File "/mnt/d/workspace/hydra/hydra-flock-demo/src/hydrus/hydrus/resources.py", line 106, in get session=get_session()) File "/mnt/d/workspace/hydra/hydra-flock-demo/src/hydrus/hydrus/data/crud.py", line 114, in get for collection in doc.collections: AttributeError: 'str' object has no attribute 'collections'

Expected Behaviour:

Nested objects should be returned properly.

Steps to reproduce:

  • Run hydra-flock-central-controller
  • add something to command collection
  • retrieve that item

Do you want to work on this issue?

NO

@Mec-iS
Copy link
Contributor

Mec-iS commented Mar 24, 2019

@xadahiya please provide a proper link to the changes you are talking about

I suppose you are talking about #295 by @vddesai1871

In place of the State object there should be an hypermedia link.

@xadahiya
Copy link
Member Author

Yes, but that is when we retrieve the object. This is the object I used to store the object in CommandCollection. The server crashes when trying to retrieve this item.

@vddesai1871
Copy link
Contributor

hydrus is working fine, I can not reproduce that same error in this repo.
This issue should be migrated to flock-controller repo. I have tried running the controller by following instructions provided there. But I am getting an installation error, I will further investigate it tommorow, meanwhile looking at that repository, it has api_docs directory and it has an old doc_gen script which defines State as not-collection class, changing collection=True for State in line 230 of doc_gen.py
might help.

in hydrus

Retrieving command object. (you can see link to the nested state object)

command

Now retrieving the state object by dereferencing the link

cm_state

@xadahiya
Copy link
Member Author

I tried that but it didn't work. Could you please try to find out what's wrong with the demo?

@Mec-iS
Copy link
Contributor

Mec-iS commented Mar 25, 2019

@xadahiya

it has api_docs directory and it has an old doc_gen script which defines State as not-collection class, changing collection=True for State in line 230 of doc_gen.py
might help.

@chrizandr
Copy link
Member

To add to this, we might have to make tests for nested objects. We don't have any right now, that is why it was missed out before merging.

@vddesai1871
Copy link
Contributor

To add to this, we might have to make tests for nested objects. We don't have any right now, that is why it was missed out before merging.

There isn't any bug related to nested objects in hydrus. I added tests related to this (in test_app.py) when I added these changes. And I have tested it manually before and now, and it is working fine. You can see the screenshots I posted above or try reproducing that bug in this repo by adding an item to command collection and retrieve it. If we are clear on this then we can migrate this issue to flock-demo repository and investigate it there.

@xadahiya
Copy link
Member Author

Cool! @vddesai1871 please create an issue in the flock-demo repo

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

No branches or pull requests

4 participants