Giter Club home page Giter Club logo

eptodocker's People

Watchers

 avatar  avatar

eptodocker's Issues

Sometimes partialView.merge raises an IndexError exception

Sometimes PartialView.py raises an exception in merge while Cyclon container is running.
The exception raised is the following:

[2017-12-13,17:16:13.464 - ERROR] base.py:131 | run_job - Job "Cyclon.shuffle_partial_view (trigger: interval[0:00:15], next run at: 2017-12-13 17:16:28 CET)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/apscheduler/executors/base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
  File "/usr/src/cyclon_project/api/cyclon.py", line 101, in shuffle_partial_view
    self.partialView.merge(neighbors, received_partial_view)
  File "/usr/src/partialView/partialView.py", line 127, in merge
    i += 1 if self.add_peer(unknown[i]) else 0
IndexError: list index out of range

More info in the following stack trace.

[2017-12-13,17:15:58.510 - INFO] cyclon.py:78 | shuffle_partial_view - My partialView:
{'ip': '172.17.0.6', 'limit': 3, 'peer_list': [{'age': 1, 'ip': '172.17.0.8'}, {'age': 2, 'ip': '172.17.0.5'}, {'age': 2, 'ip': '172.17.0.9'}], 'shuffle_length': 3, 'size': 3}
[2017-12-13,17:15:58.511 - INFO] cyclon.py:81 | shuffle_partial_view - Selected oldest: 172.17.0.5
[2017-12-13,17:15:58.513 - INFO] cyclon.py:84 | shuffle_partial_view - Selected neighbors:
{'ip': '172.17.0.6', 'limit': 3, 'peer_list': [{'age': 2, 'ip': '172.17.0.9'}, {'age': 1, 'ip': '172.17.0.8'}], 'shuffle_length': 3, 'size': 2}
[2017-12-13,17:15:58.513 - INFO] cyclon.py:87 | shuffle_partial_view - Selected neighbors + myself (will be sent to 172.17.0.5):
{'ip': '172.17.0.6', 'limit': 3, 'peer_list': [{'age': 2, 'ip': '172.17.0.9'}, {'age': 1, 'ip': '172.17.0.8'}, {'age': 0, 'ip': '172.17.0.6'}], 'shuffle_length': 3, 'size': 3}
[2017-12-13,17:15:58.514 - INFO] cyclon.py:110 | send_message - I am sending Message:
{'source': 'http://172.17.0.6:5000', 'destination': 'http://172.17.0.5:5000', 'data': {'ip': '172.17.0.6', 'limit': 3, 'peer_list': [{'age': 2, 'ip': '172.17.0.9'}, {'age': 1, 'ip': '172.17.0.8'}, {'age': 0, 'ip': '172.17.0.6'}], 'shuffle_length': 3, 'size': 3}}
[2017-12-13,17:15:58.519 - INFO] cyclon.py:112 | send_message - I got the following response:
<Response [200]>
[2017-12-13,17:15:58.520 - INFO] cyclon.py:94 | shuffle_partial_view - I received (from 172.17.0.5):
{'ip': '172.17.0.5', 'limit': 3, 'peer_list': [{'age': 2, 'ip': '172.17.0.8'}, {'age': 8, 'ip': '172.17.0.2'}, {'age': 2, 'ip': '172.17.0.6'}], 'shuffle_length': 3, 'size': 3}
[2017-12-13,17:15:58.520 - INFO] cyclon.py:98 | shuffle_partial_view - My partialView after removing oldest:
{'ip': '172.17.0.6', 'limit': 3, 'peer_list': [{'age': 1, 'ip': '172.17.0.8'}, {'age': 2, 'ip': '172.17.0.9'}], 'shuffle_length': 3, 'size': 2}
[2017-12-13,17:15:58.520 - INFO] cyclon.py:102 | shuffle_partial_view - My partialView after merging:
{'ip': '172.17.0.6', 'limit': 3, 'peer_list': [{'age': 1, 'ip': '172.17.0.8'}, {'age': 2, 'ip': '172.17.0.9'}, {'age': 8, 'ip': '172.17.0.2'}], 'shuffle_length': 3, 'size': 3}
[2017-12-13,17:15:58.520 - INFO] base.py:135 | run_job - Job "Cyclon.shuffle_partial_view (trigger: interval[0:00:15], next run at: 2017-12-13 17:16:13 CET)" executed successfully
[2017-12-13,17:15:59.759 - INFO] views.py:75 | get_k_view - {'ip': '172.17.0.6', 'limit': 3, 'peer_list': [{'age': 1, 'ip': '172.17.0.8'}, {'age': 2, 'ip': '172.17.0.9'}, {'age': 8, 'ip': '172.17.0.2'}], 'shuffle_length': 3, 'size': 3}
[2017-12-13,17:16:13.456 - INFO] base.py:123 | run_job - Running job "Cyclon.shuffle_partial_view (trigger: interval[0:00:15], next run at: 2017-12-13 17:16:13 CET)" (scheduled at 2017-12-13 17:16:13.445482+01:00)
[2017-12-13,17:16:13.456 - INFO] cyclon.py:74 | shuffle_partial_view - Shuffling
[2017-12-13,17:16:13.456 - INFO] cyclon.py:78 | shuffle_partial_view - My partialView:
{'ip': '172.17.0.6', 'limit': 3, 'peer_list': [{'age': 2, 'ip': '172.17.0.8'}, {'age': 3, 'ip': '172.17.0.9'}], 'shuffle_length': 3, 'size': 2}
[2017-12-13,17:16:13.456 - INFO] cyclon.py:81 | shuffle_partial_view - Selected oldest: 172.17.0.9
[2017-12-13,17:16:13.457 - INFO] cyclon.py:84 | shuffle_partial_view - Selected neighbors:
{'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 2, 'ip': '172.17.0.8'}], 'shuffle_length': 2, 'size': 1}
[2017-12-13,17:16:13.457 - INFO] cyclon.py:87 | shuffle_partial_view - Selected neighbors + myself (will be sent to 172.17.0.9):
{'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 2, 'ip': '172.17.0.8'}, {'age': 0, 'ip': '172.17.0.6'}], 'shuffle_length': 2, 'size': 2}
[2017-12-13,17:16:13.457 - INFO] cyclon.py:110 | send_message - I am sending Message:
{'source': 'http://172.17.0.6:5000', 'destination': 'http://172.17.0.9:5000', 'data': {'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 2, 'ip': '172.17.0.8'}, {'age': 0, 'ip': '172.17.0.6'}], 'shuffle_length': 2, 'size': 2}}
[2017-12-13,17:16:13.463 - INFO] cyclon.py:112 | send_message - I got the following response:
<Response [200]>
[2017-12-13,17:16:13.463 - INFO] cyclon.py:94 | shuffle_partial_view - I received (from 172.17.0.9):
{'ip': '172.17.0.9', 'limit': 1, 'peer_list': [{'age': 2, 'ip': '172.17.0.7'}], 'shuffle_length': 1, 'size': 1}
[2017-12-13,17:16:13.463 - INFO] cyclon.py:98 | shuffle_partial_view - My partialView after removing oldest:
{'ip': '172.17.0.6', 'limit': 3, 'peer_list': [{'age': 2, 'ip': '172.17.0.8'}], 'shuffle_length': 3, 'size': 1}
[2017-12-13,17:16:13.464 - ERROR] base.py:131 | run_job - Job "Cyclon.shuffle_partial_view (trigger: interval[0:00:15], next run at: 2017-12-13 17:16:28 CET)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/apscheduler/executors/base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
  File "/usr/src/cyclon_project/api/cyclon.py", line 101, in shuffle_partial_view
    self.partialView.merge(neighbors, received_partial_view)
  File "/usr/src/partialView/partialView.py", line 127, in merge
    i += 1 if self.add_peer(unknown[i]) else 0
IndexError: list index out of range

Add minikube status checks to bash scripts

Since version 0.24.0, Minikube has introduces different exit codes for the command minikube status. There are several bash scripts in the project that require a minikube cluster up and running. In order to be able to execute the scripts, some checks about the cluster status are needed.

Refer to this: #1944

Introduce API versioning

API endpoints should start with the version of API currently used.
For example, localhost:5000/exchange-view should become to localhost:5000/v1/exchange-view.

Sometimes exchange_view() raises an IndexError exception

The exception is the following:

Internal Server Error: /exchange-view
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/src/cyclon_project/api/views.py", line 102, in exchange_view
    cyclon.partialView.merge(to_send, received_partial_view)
  File "/usr/src/partialView/partialView.py", line 131, in merge
    self.remove_peer(can_be_replaced[i - how_many])
IndexError: list index out of range
[2017-12-13,17:22:00.424 - ERROR] exception.py:118 | handle_uncaught_exception - Internal Server Error: /exchange-view
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/src/cyclon_project/api/views.py", line 102, in exchange_view
    cyclon.partialView.merge(to_send, received_partial_view)
  File "/usr/src/partialView/partialView.py", line 131, in merge
    self.remove_peer(can_be_replaced[i - how_many])
IndexError: list index out of range

More info in the following stack trace.

[2017-12-13,17:21:58.446 - INFO] cyclon.py:78 | shuffle_partial_view - My partialView:
{'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 1, 'ip': '172.17.0.9'}, {'age': 1, 'ip': '172.17.0.5'}], 'shuffle_length': 2, 'size': 2}
[2017-12-13,17:21:58.447 - INFO] cyclon.py:81 | shuffle_partial_view - Selected oldest: 172.17.0.9
[2017-12-13,17:21:58.447 - INFO] cyclon.py:84 | shuffle_partial_view - Selected neighbors:
{'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 1, 'ip': '172.17.0.5'}], 'shuffle_length': 2, 'size': 1}
[2017-12-13,17:21:58.447 - INFO] cyclon.py:87 | shuffle_partial_view - Selected neighbors + myself (will be sent to 172.17.0.9):
{'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 1, 'ip': '172.17.0.5'}, {'age': 0, 'ip': '172.17.0.6'}], 'shuffle_length': 2, 'size': 2}
[2017-12-13,17:21:58.447 - INFO] cyclon.py:110 | send_message - I am sending Message:
{'source': 'http://172.17.0.6:5000', 'destination': 'http://172.17.0.9:5000', 'data': {'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 1, 'ip': '172.17.0.5'}, {'age': 0, 'ip': '172.17.0.6'}], 'shuffle_length': 2, 'size': 2}}
[2017-12-13,17:21:58.452 - INFO] cyclon.py:112 | send_message - I got the following response:
<Response [200]>
[2017-12-13,17:21:58.453 - INFO] cyclon.py:94 | shuffle_partial_view - I received (from 172.17.0.9):
{'ip': '172.17.0.9', 'limit': 1, 'peer_list': [{'age': 1, 'ip': '172.17.0.8'}], 'shuffle_length': 1, 'size': 1}
[2017-12-13,17:21:58.453 - INFO] cyclon.py:98 | shuffle_partial_view - My partialView after removing oldest:
{'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 1, 'ip': '172.17.0.5'}], 'shuffle_length': 2, 'size': 1}
[2017-12-13,17:21:58.453 - INFO] cyclon.py:102 | shuffle_partial_view - My partialView after merging:
{'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 1, 'ip': '172.17.0.5'}, {'age': 1, 'ip': '172.17.0.8'}], 'shuffle_length': 2, 'size': 2}
[2017-12-13,17:21:58.453 - INFO] base.py:135 | run_job - Job "Cyclon.shuffle_partial_view (trigger: interval[0:00:15], next run at: 2017-12-13 17:22:13 CET)" executed successfully
[2017-12-13,17:21:59.753 - INFO] views.py:75 | get_k_view - {'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 1, 'ip': '172.17.0.5'}, {'age': 1, 'ip': '172.17.0.8'}], 'shuffle_length': 2, 'size': 2}
[2017-12-13,17:22:00.424 - INFO] views.py:90 | exchange_view - My view before the exchange is:
{'ip': '172.17.0.6', 'limit': 2, 'peer_list': [{'age': 1, 'ip': '172.17.0.8'}], 'shuffle_length': 2, 'size': 1}
[2017-12-13,17:22:00.424 - INFO] views.py:95 | exchange_view - I got (from http://172.17.0.7:5000) the following:
{'ip': '172.17.0.7', 'limit': 3, 'peer_list': [{'age': 1, 'ip': '172.17.0.2'}, {'age': 2, 'ip': '172.17.0.8'}, {'age': 0, 'ip': '172.17.0.7'}], 'shuffle_length': 3, 'size': 3}
[2017-12-13,17:22:00.424 - INFO] views.py:99 | exchange_view - I will send (to http://172.17.0.7:5000) the following:
{'ip': '172.17.0.6', 'limit': 1, 'peer_list': [{'age': 1, 'ip': '172.17.0.8'}], 'shuffle_length': 1, 'size': 1}.
Internal Server Error: /exchange-view
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/src/cyclon_project/api/views.py", line 102, in exchange_view
    cyclon.partialView.merge(to_send, received_partial_view)
  File "/usr/src/partialView/partialView.py", line 131, in merge
    self.remove_peer(can_be_replaced[i - how_many])
IndexError: list index out of range
[2017-12-13,17:22:00.424 - ERROR] exception.py:118 | handle_uncaught_exception - Internal Server Error: /exchange-view
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/src/cyclon_project/api/views.py", line 102, in exchange_view
    cyclon.partialView.merge(to_send, received_partial_view)
  File "/usr/src/partialView/partialView.py", line 131, in merge
    self.remove_peer(can_be_replaced[i - how_many])
IndexError: list index out of range

Cyclon exchange_view() should not return back to the source a partialView containing the source's ip

In cyclon/app.py the following piece of code is wrong.

source = message.get('source')
size = received_partial_view.size
to_avoid = None
if cyclon.partialView.contains_ip(source):
    to_avoid = cyclon.partialView.get_peer_by_ip(source)
to_send = cyclon.partialView.select_neighbors(to_avoid, size)

In fact, source is in the form http://<source_ip>:<port> while both cyclon.partialView.contains_ip and cyclon.partialView.get_peer_by_ip expect an IP. Hence, to_avoid value was alway None.

Investigate Flask Deployment Options

As stated here:

While lightweight and easy to use, Flask’s built-in server is not suitable for production as it doesn’t scale well and by default serves only one request at a time.

We need to handle more than one request at a time.

Cyclon get_k_view should return a list of IPs

Right now get_k_view() route in cyclon/app.py returns a list of PodDescriptor. However, EpTO does not need to know what is a PodDescriptor, neither will use the concept of "age" for each peer. Hence, get_k_view() should return a list of IPs so that EpTO can simply go through the list and send messages to each entry of the list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.