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

SERAC activities filtering does not work #909

Open
mgerbaux opened this issue Nov 12, 2020 · 21 comments
Open

SERAC activities filtering does not work #909

mgerbaux opened this issue Nov 12, 2020 · 21 comments

Comments

@mgerbaux
Copy link

filtering xreports on activities returns no result : https://www.camptocamp.org/xreports?act=skitouring
maybe linked with the reorganization of activities dedicated to SERAC (c0f7e60 ?)

@ataraxido
Copy link

@momomaniac @cbeauchesne on my local dev API I get a PGSQL error :

psycopg2.ProgrammingError: column xreports.event_activity does not exist

And also elasticsearch, when searching xreports, returns

"activities": [
"ice_climbing"
],

instead of

"event_activity": "ice_climbing"

Could you tell me if the dev is iso and the issue is also in production or if it's the dev which isn't up to date and the migration I should roll ?

@brunobesson
Copy link
Member

I am not working on the backend side. But having activities as an array rather than a single one is a good sign that some things were missed with last SERAC migration.
@momomaniac ?

@ataraxido
Copy link

The thing is that I found the migration script of this field, that's why I'm wondering if it's only on my dev or also in production ; cc @cbeauchesne

@cbeauchesne
Copy link
Member

It's also in prod. But my guess is that the elastic search part of that change has not be done

@ataraxido
Copy link

Ah yes, indeed, what I saw is the sql migration
But if it has been ran in production you shouldn't get this on production environment, right ?

psycopg2.ProgrammingError: column xreports.event_activity does not exist

@cbeauchesne
Copy link
Member

Yes, strange, I expect sawing an elasticsearch error Oo

Is it the same error on prod, on a your dev env ?

@ataraxido
Copy link

ataraxido commented Nov 23, 2020

Sorry @cbeauchesne but I didn't understand your message.

The file we are talking : https://github.com/c2corg/v6_api/blob/master/alembic_migration/versions/06d2a35e39c8_improve_serac_database.py ; haven't been ran ?

@cbeauchesne
Copy link
Member

Pretty sure it has ran, it's automatic.

I need to make some tests, I'll try to find some timme this week

@ataraxido
Copy link

Any news on this @cbeauchesne ?

@momomaniac
Copy link
Contributor

Hello @ataraxido , nice to see you on board, I've not been around a lot recently.

I checked the db on demo and prod, they both do include the SERAC modifications:

demo:

# alembic history
06d2a35e39c8 -> bece9007ab83 (head), Add documents tags
85a5ed3c76a8 -> 06d2a35e39c8, Improve SERAC database
83956b269661 -> 85a5ed3c76a8, Add index on AssociationLog
24f8da659c78 -> 83956b269661, Add rate limiting structure
etc.

prod:

# alembic history                                                                           
85a5ed3c76a8 -> 06d2a35e39c8 (head), Improve SERAC database
83956b269661 -> 85a5ed3c76a8, Add index on AssociationLog
etc.

so I'm also quite surprised about the sqlalchemy error.
I'll do some further checks and try to find out what's going on.

@momomaniac
Copy link
Contributor

for your local dev environment, you should check your docker-compose logs for alembic errors, maybe some db migration has gone wrong locally.

you can check the alembic version on your composition with:

docker-compose exec api alembic current
docker-compose exec api alembic history

or you could try to force update the DB locally:

docker-compose exec api alembic upgrade head

then you might see useful error messages.

@momomaniac
Copy link
Contributor

momomaniac commented Dec 28, 2020

I checked the filters on the demo server,
https://api.demov6.camptocamp.org/xreports?act=skitouring
it seems to work all right, but it does not work on the prod server
https://api.camptocamp.org/xreports?act=skitouring

actually the elastic search mapping is up to date on demo, but not on prod (prod still has the old index definitions with field activities instead of event_activity)
So the ES mapping has not been updated correctly when putting the feature in prod. I found ES migration scripts in https://github.com/c2corg/v6_api/tree/master/es_migration, but I don't know if this is still up to date... Or is there any automatic way to update the ES mappings ???

@brunobesson
Copy link
Member

I did not update the syncer for the update following your work I wasn't aware of the need. So let's make the next update (which will update the syncer) and see if everything gets solved.

@brunobesson
Copy link
Member

OK, the syncer seems ok now. But only new activities are taken into account.
Would @momomaniac or @cbeauchesne be able to write the code to run once the query to index all previous serac reports?
I might be able to do it, but as I do not write any python this could take a lot of useless time...

@momomaniac
Copy link
Contributor

momomaniac commented Jan 6, 2021 via email

@ataraxido
Copy link

Any news ? :)

@loicperrin
Copy link

Up ! @momomaniac

1 similar comment
@brunobesson
Copy link
Member

Up ! @momomaniac

@momomaniac
Copy link
Contributor

momomaniac commented Apr 2, 2021 via email

@ataraxido
Copy link

C'est pour la blague hein ;)

@loicperrin
Copy link

Up @momomaniac ! Si tu as un peu de temps, ce serait cool de débloquer ce sujet.

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

No branches or pull requests

6 participants