Open-event-droidgen: Test generator and app against newly created event

Created on 31 Jan 2018  路  27Comments  路  Source: fossasia/open-event-droidgen

  • Create a new event using latest API
  • Fill all required info in the event
  • Generate an app using generator giving it the link to created event
  • Test the app using the option of downloading data
High

Most helpful comment

rant

All 27 comments

I'll do this, I am already creating an event for developing/testing in the orga-app project.

@iamareebjamal I created a new event and hosted the app generator locally but i am getting the following error when i try to create the android app.

Screenshot:
image

Logcat:

ERROR in app: Exception on / [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/media/srv_twry/work/Projects/CommunityProjects/Fossasia/open-event-android/apk-generator/v2/app/views/__init__.py", line 95, in process
    task = generate_app_task.delay(config=app.config, payload=payload, via_api=via_api, identifier=identifier, build_type=build_type, theme_colors=theme_colors)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 461, in delay
    return self.apply_async(args, kwargs)
  File "/media/srv_twry/work/Projects/CommunityProjects/Fossasia/open-event-android/apk-generator/v2/app/utils/libs/request_context_task.py", line 57, in apply_async
    return super(RequestContextTask, self).apply_async(args, kwargs, **rest)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 573, in apply_async
    **dict(self._get_exec_options(), **options)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/base.py", line 354, in send_task
    reply_to=reply_to or self.oid, **options
  File "/usr/local/lib/python2.7/dist-packages/celery/app/amqp.py", line 310, in publish_task
    **kwargs
  File "/usr/local/lib/python2.7/dist-packages/kombu/messaging.py", line 172, in publish
    routing_key, mandatory, immediate, exchange, declare)
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 470, in _ensured
    interval_max)
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 382, in ensure_connection
    interval_start, interval_step, interval_max, callback)
  File "/usr/local/lib/python2.7/dist-packages/kombu/utils/__init__.py", line 246, in retry_over_time
    return fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 250, in connect
    return self.connection
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 756, in connection
    self._connection = self._establish_connection()
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 711, in _establish_connection
    conn = self.transport.establish_connection()
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/virtual/__init__.py", line 809, in establish_connection
    self._avail_channels.append(self.create_channel(self))
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/virtual/__init__.py", line 791, in create_channel
    channel = self.Channel(connection)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 466, in __init__
    self._disconnect_pools()
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 484, in _disconnect_pools
    self._async_pool.disconnect()
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 998, in disconnect
    connection.disconnect()
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 866, in disconnect
    channel._on_connection_disconnect(self)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 498, in _on_connection_disconnect
    raise get_redis_ConnectionError()
ConnectionError
Exception on / [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/media/srv_twry/work/Projects/CommunityProjects/Fossasia/open-event-android/apk-generator/v2/app/views/__init__.py", line 95, in process
    task = generate_app_task.delay(config=app.config, payload=payload, via_api=via_api, identifier=identifier, build_type=build_type, theme_colors=theme_colors)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 461, in delay
    return self.apply_async(args, kwargs)
  File "/media/srv_twry/work/Projects/CommunityProjects/Fossasia/open-event-android/apk-generator/v2/app/utils/libs/request_context_task.py", line 57, in apply_async
    return super(RequestContextTask, self).apply_async(args, kwargs, **rest)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 573, in apply_async
    **dict(self._get_exec_options(), **options)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/base.py", line 354, in send_task
    reply_to=reply_to or self.oid, **options
  File "/usr/local/lib/python2.7/dist-packages/celery/app/amqp.py", line 310, in publish_task
    **kwargs
  File "/usr/local/lib/python2.7/dist-packages/kombu/messaging.py", line 172, in publish
    routing_key, mandatory, immediate, exchange, declare)
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 470, in _ensured
    interval_max)
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 382, in ensure_connection
    interval_start, interval_step, interval_max, callback)
  File "/usr/local/lib/python2.7/dist-packages/kombu/utils/__init__.py", line 246, in retry_over_time
    return fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 250, in connect
    return self.connection
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 756, in connection
    self._connection = self._establish_connection()
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 711, in _establish_connection
    conn = self.transport.establish_connection()
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/virtual/__init__.py", line 809, in establish_connection
    self._avail_channels.append(self.create_channel(self))
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/virtual/__init__.py", line 791, in create_channel
    channel = self.Channel(connection)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 466, in __init__
    self._disconnect_pools()
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 484, in _disconnect_pools
    self._async_pool.disconnect()
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 998, in disconnect
    connection.disconnect()
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 866, in disconnect
    channel._on_connection_disconnect(self)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 498, in _on_connection_disconnect
    raise get_redis_ConnectionError()
ConnectionError

Can you make sense of the logcat ? I am not at all familiar with flask.

Same I am also getting the same error @srv-twry

You have to give it the API endpoint and not frontend endpoint

Also, for the most part, you'll have to use API to complete the event as frontend may not be functionally complete

@mayank8318 @simarsingh24 @nikit19 Kindly look at this issue since this has a high priority. It is not an assignable issue i.e. everyone should do this and submit their experience.

@srv-twry I am also getting the same error.
https://open-event-api.herokuapp.com/v1/events/198
used this as open event API endpoint

@simarsingh24 @srv-twry You need to set up redis :
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-redis

@iamareebjamal I am getting No JSON object could be decoded. So I guess my API link is wrong?

@mayank8318 what API link did you use?

@simarsingh24 I used https://api.eventyay.com/v1/events/6 but the server is down I guess because I got a 503.

@mayank8318 you can use software (like postman ) to test the response you are getting
This seems to be active https://open-event-api.herokuapp.com/v1/events/198 why dont you give it a try?

@simarsingh24 Did you get an active link as https://open-event-api.herokuapp.com/v1/events/198 returned an empty response

@mayank8318 You were using legacy API link

How long does it take to create an apk? It has been more than 30 minutes.
image

I guess it is happening because I wasn't able to run these lines
sudo cp kubernetes/images/generator/tools /opt
sudo ./kubernetes/images/generator/android.sh

I get this error when I run those lines

image
Any idea?

You don't have to run those files at all and you can check the logs to know what is happening

@nikit19 Since you already have Android SDK no need to run that. Just set your PATH variable properly.

What is the correct API link?

@shivaraju07 You have to create an event and use that link. There is no general event link.

@iamareebjamal will you please be more specific as you sound like a lot general. You might have a lot of experience in coding and all these but we are here the newbies who want to learn while contributing.
As in the above issue you have not mentioned where to find the new api , how to create the new event , infect what is an event in this contrast . So giving more details for a particular will be a little more helpful for us (as we will get a better understanding) and for this project (As issue will be solve much more fast).
Thanks

rant

@iamareebjamal Thanks for your humorous answer.

Hello sorry for asking another question! I would like to be a new contributor to the project. I'm not sure if I should start by sharing my experience in this issue or to work on other easier issues.

The error mentioned by @nikit19 can be solved by making an alias for sudo as mentioned at https://stackoverflow.com/questions/12996397/command-not-found-when-using-sudo . Also, the keystore password has to be 6 characters long so it cannot be 'debug' which was stated in the installation instructions. Maybe the installation instructions could be updated to reflect these. I used a keystore password which is 'debug1' if not it did not let me create a keystore.

I have set up everything and the Open Event Apk Generator loads on localhost:8080 really well. I have also gotten Redis to run and checked that it was running. However, I am still getting No JSON object could be decoded. even though I have been using the API link at https://open-event-api.herokuapp.com/v1/events/198. I hope I'm installing these in the correct direction, should I try setting up the Open Event API Server locally and making my own event using the local installation at https://github.com/fossasia/open-event-server? Or did the keystore password affect anything?

Thank you!

Seems like due to incompatibility between legacy server API architecture and JSON expected by the APK, we cannot use the generator right now by using API links. I fixed the endpoint code of generator but the JSON downloaded is not compatible with what the app expects. I'll be discussing about possible course of action in this scenario. Thanks for everyone for sharing their experience. It's good that we detected the issue beforehand.

Right now, what we can do is test the zip file of events as they should be working without any problem as they contain the JSON in right format and also the API link which is used by the app for pulling resources

These are the open event JSON zip samples - https://github.com/fossasia/open-event/tree/master/sample

@iamareebjamal because retrofit is using JsonApi converter it is parsing api end point correctly but when downloading from assets it is using only jackson object mapper so it can not parse new jsonapi format. So I decided to change the apk generator code and used JsonApi ResourceConverter to parse json downloaded from assets and as expected because retrofit can parse, it is also parsing the json.

If we change this now than all the samples available in open event repo will be deprecated we can not use it to generate our app. So I'm thinking about making one converter that will take old sample parse it using object mapper, then create new event in api end point by posting it and then create new sample zip by getting that event.

Because of open event web app also using this sample so we can not change it now.

Please tell me what do you think about this approach and should I work on this issue now?

The format of sample should remain same. The app should work with the format of sample because it is not to be changed, The app is not working with new API links, this is the issue I think

The format of the sample should be same as now, So we need to change the apk generater so that it will generate the assets same format as of samples when provide api link in apkgen. Am I understanding right?

Yes :+1: You should check out if there is event export function in the new api and is working correctly or not

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dr0pdb picture dr0pdb  路  3Comments

mariobehling picture mariobehling  路  6Comments

dr0pdb picture dr0pdb  路  7Comments

97k picture 97k  路  5Comments

dr0pdb picture dr0pdb  路  5Comments