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

Status #76

Open
gyachdav opened this issue Dec 7, 2016 · 21 comments
Open

Status #76

gyachdav opened this issue Dec 7, 2016 · 21 comments
Assignees
Labels

Comments

@gyachdav
Copy link

gyachdav commented Dec 7, 2016

Hello there PredictPokemon and @PokemonGoers/pokedata. We are trying to figure out where things stand and how come we do not see any predictions on the predictemall app. It is unclear to us whether integration ever took place or whether the prediction package is failing. We are now waiting on action to resolve this before we move on with grading the whole class so please resolve this asap so we can wrap up this project and this semester.

Thanks,
The mentors

@semioniy
Copy link
Collaborator

semioniy commented Dec 7, 2016

Well, I didn't even know we are stuck. As a member of prediction team I have no idea about what's going on with server/web/whichever other side of the project, so we need here some sort of status update. It's like "tell me what happens and I'll tell you why").
So, what does happen?

@swathi-ssunder
Copy link

The integration of the predictions was indeed done(at least from our end) and the entire discussion is on PokemonGoers/PokeData#183. The last update from @jonas-he suggests that there are no requests for predictions.
@semioniy - This is what happens - PokemonGoers/PokeData#183 (comment)

@semioniy
Copy link
Collaborator

semioniy commented Dec 7, 2016

Well, we can't do much until someone says "we make requests but get no predictions".

@semioniy semioniy closed this as completed Dec 7, 2016
@semioniy semioniy reopened this Dec 7, 2016
@vivek-sethia
Copy link

We are in a similar state. Maybe the map team( @PokemonGoers/pokemap-1 / @PokemonGoers/pokemap-2 ) or the UI team ( @PokemonGoers/catch-em-all ) has a better idea of why the requests are not being made

@gqinami
Copy link

gqinami commented Dec 8, 2016

Hi everyone,
We from PokeMap1 just found out via this thread that we should request the predictions via an endpoint in the database. First idea was that we should directly use the package from Prediction team. HOwever, with that said, we can implement today the requests for predictions (the structure is currently implemented), once we know the endpoint, but we see that the API is down for the moment, and has been down for past days. Please let us know when the API is up again, and we will implement them very quickly.

Best,
PokeMap1

@jonas-he
Copy link

jonas-he commented Dec 8, 2016

@gqinami
API is at https://predictemall.online/api
For documentation of the routes see https://github.com/PokemonGoers/PokeData/blob/develop/app/api/sighting.js

an example of a prediction request would be:
https://predictemall.online/api/pokemon/prediction/coordinates/37.787682,%20-122.446355/ts/1481239833462

However it seems that im always getting a 504 Gateway Time-out error when trying such request. Could be that the internal computing of the prediction takes more time than the timeout of a proxy/gateway in front of the actual server ?! Can this be configured @sacdallago ?

@gqinami
Copy link

gqinami commented Dec 10, 2016

Hey everyone,

We published the new npm package with the information on the above comment from Jonas that should now show the predictions in the map:

https://www.npmjs.com/package/pokemap-1

However, as a side note, we were not able to test it since the API is not working. Please let us know if anything else is needed from our side.

Best,
PokeMap1 team

@gyachdav
Copy link
Author

Extending the time out time is not the answer. Running a prediction should be an async process with polling. A runPrediction operation should return a ticketID and the polling process should return an event once the ticketId changes status to completed|error. This is a job for @PokemonGoers/pokedata.

@PokemonGoers/pokedata please confirm you got the message and on it.

@samitsv
Copy link

samitsv commented Dec 18, 2016

@gyachdav looking in to the issue and will update soon

@samitsv
Copy link

samitsv commented Dec 18, 2016

updated the api for prediction, PokemonGoers/PokeData#199, but one of the build fails https://travis-ci.org/PokemonGoers/PokeData/jobs/184915843

@samitsv
Copy link

samitsv commented Dec 18, 2016

and is there a way to test the predictions locally? I see on start the prediction requests for sightings on production environment, would be great if there is a configuration to test it offline, since the api is currently down

@jonas-he
Copy link

jonas-he commented Dec 18, 2016

I checked the integration of the prediction package and request parameters are passed successfully to the prediction package (more specifically the predictor.predict function).
Another thing is that in prediction.js of the prediction team the url 'http://predictemall.online:65014/api/pokemon/sighting' is hardcoded, I guess it is to fetch past sightings to generate training data. But the website predictemall.online is currently down @sacdallago and thus the predictions have no data to start with and the prediction just doesn't finish.
After pointing the hardcoded url to my local API (where I have some thousand sightings) this is what comes up:
error

It would be nice of the prediction team to have a look at the integration into our project, since it seems to fail at their package (hint: it seems to happen at the createTestData function). Also I would like to reactivate @sacdallago to give his input on the server issues, maybe @gyachdav can do this for us?

@Aurel-Roci
Copy link
Collaborator

@jonas-he The url is hardcoded but can be changed, using predictor.url = URL, also I dont really see how it fails at our package in the error log above. Maybe the npm-debug.log has more info about the error.

@jonas-he
Copy link

jonas-he commented Dec 18, 2016

@Aurel-Roci
Well, you can't really tell that it fails on your side from the error message itself, thats correct, but from the context of my actions. Maybe I did not explain it too well: I run the our server code locally and for that to work i also have a local instance of MongoDB. First i ran it with predictor.url pointing to the dead predictemall.online link. It did not crash. Then I changed it to my local API. It did crash.
Ok I think I've found the culprit. It is the periodical requests from your prediction package. These requests have a special token that makes the response of unlimited size (PokemonGoers/PokeData#193) and it seems that for those request in my DB there are a lot of entries. As a result an error in the processing of these big amounts of data, the process runs out of memory (either the sending one of our package or the receiving one of the prediction package). I have to say that I think this token was a rather bad idea as JSON data is not designed to be several 100 MBs in size. As a fix I propose either adding those options to our node command: node --max_old_space_size=4096 --optimize_for_size --max_executable_size=4096 --stack_size=4096 app.js (but beware: on my system the node process used 4GB RAM for one query of the prediction package) or we change the way the prediction package queries our API.
Edit: After running it with increased memory the prediction package was done with the download and building of the training data after 5 minutes (I guess) and then I started a prediction request by typing this into my browser http://localhost:8080/api/pokemon/prediction/coordinates/-70.6626205,-33.4609206/ts/2016-09-14T08:00:00.000Z
It threw an UnknownFeatureKey right after this request:

$ node --max_old_space_size=4096 --optimize_for_size --max_executable_size=4096 --stack_size=4096 app.js
SUCCESS Application started successfully
INFO Going to connect to mongodb://localhost:27017/PokeData
2016-12-18T14:37:26.767Z started prediction script, init DC
5455ms to construct shortcut table
Average timezones per 1° lat x 1° lng: 4.414128352490422
2016-12-18T14:37:36.627Z created training arff file
2016-12-18T14:37:36.628Z requesting http://localhost:8080/api/pokemon/sighting/ts/2016-09-14T
08:00:00.000Z/range/1d?token=I0TPIIpCLH8lR8iDrCMV
INFO Listening on port 8080
INFO Mongoose connected
INFO Got pokemon name list
INFO Request incoming: /pokemon/sighting/ts/2016-09-14T08:00:00.000Z/range/1d?token=I0TPIIpCL
H8lR8iDrCMV
INFO Get Pokemon Sightings within a specific time range
ERROR [Error: Status Code: 401]
2016-12-18T14:40:16.636Z downloaded 445521 sightings from API
2016-12-18T14:41:01.984Z filtered data, new length 10000
The key pokemonId is not in the raw API data.

C:\Users\joniu\Desktop\PokeData\node_modules\predict-pokemon\feature_sources\api_features.js:
27
                throw "UnknownFeatureKey";
                ^
 UnknownFeatureKey

@bensLine
Copy link
Collaborator

Can you provide a sighting entire from the json data @jonas-he? Seems like a different key is expected 'pokemonId'.

@jonas-he
Copy link

@bensLine
I print debuged it and the error is thrown in the getFeatures function of predict-pokemon\feature_sources\api_features.js
the keys parameter is [ 'pokemonId', 'latitude', 'longitude' ]
and the pokeEntry causing trouble is

{ _id: '57d90bcc5e9ef000110830d4',
  appearedOn: '2016-09-14T08:33:35.000Z',
  source: 'POKERADAR',
  __v: 0,
  location:
   { coordinates: [ -117.9265020508, 34.0211675316 ],
     type: 'Point' },
  latitude: 34.0211675316,
  longitude: -117.9265020508,
  appearedLocalTime: '2016-09-14T00:33:35.000Z' }

so the error gets thrown because the pokeEntry is missing the key pokemonId.
This error propagates all the way to the top and then crashes the whole program. This should be handled in your package. Either discard the entry or say "sorry we can't provide predictions because of bad data" but don't throw an error which you don't catch.

@bensLine
Copy link
Collaborator

I see. So far we never had poke entries from the API without the key 'pokemonId'. The location is missing sometimes, in this case we ignore the entry. The missing pokemonId however is new. Why do we store sightings without pokemonId?
We'll ignore such sightings on our site.

@jonas-he
Copy link

i guess the idea was "the more data the better". But now scraping for sightings is basically dead, so we won't change our DB and it would be a hassle to delete all the "wrong" entries (as i would need to ask christian for DB access and so on and he seems to be out of reach).

@bensLine
Copy link
Collaborator

Yeah it's fine. Thanks for the debugging anyway. @Aurel-Roci can you update the npm package after merging #78 if it's fine?

@Aurel-Roci
Copy link
Collaborator

Yeah I can do that

Aurel-Roci added a commit that referenced this issue Dec 20, 2016
@jonas-he
Copy link

jonas-he commented Jan 3, 2017

@gyachdav we solved the problems and I do see predictions returned now on my local machine. However the server at predictemall.online seems to have crashed and we need @sacdallago to resolve this, since he has access to it.

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

9 participants