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

Latest perceval seems to break grimoire_elk #222

Closed
jgbarah opened this issue Feb 25, 2018 · 2 comments
Closed

Latest perceval seems to break grimoire_elk #222

jgbarah opened this issue Feb 25, 2018 · 2 comments
Labels

Comments

@jgbarah
Copy link
Contributor

jgbarah commented Feb 25, 2018

When trying to use the master/HEAD for perceval, perceval-mozilla and perceval-opnfv, it seems grimoire_elk fails. For example, when running p2o.py:

2018-02-23 17:08:00,421 - grimoire_elk.arthur - ERROR - Error feeding ocean 'GitCommand' object has no attribute 'backend'
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/arthur.py", line 121, in feed_backend
    backend = backend_cmd.backend
AttributeError: 'GitCommand' object has no attribute 'backend'

I can patch grimoire_elk/arthur.py to get rid of this error:

a/grimoire_elk/arthur.py
+++ b/grimoire_elk/arthur.py
@@ -118,7 +118,7 @@ def feed_backend(url, clean, fetch_cache, backend_name, backend_params,
     try:
         backend_cmd = klass(*backend_params)
-        backend = backend_cmd.backend
+        backend = backend_cmd.BACKEND
         ocean_backend = connector[1](backend, fetch_cache=fetch_cache, project=project)
         logger.info("Feeding Ocean from %s (%s)", backend_name, backend.origin)

But I still get more errors:

p2o.py --enrich --index git_raw --index-enrich git -e https://admin:admin@localhost:9200 --no_inc --debug git https://github.com/grimoirelab/perceval.git
....
2018-02-23 23:27:45,554 Error feeding ocean from git (<property object at 0x7f188b7b6778>): fetch() missing 1 required positional argument: 'self'
Traceback (most recent call last):
  File "/home/jgb/src/jgbarah/mordred/grimoire_elk/arthur.py", line 197, in feed_backend
    ocean_backend.feed()
  File "/home/jgb/src/jgbarah/mordred/grimoire_elk/ocean/elastic.py", line 202, in feed
    items = self.perceval_backend.fetch()
TypeError: fetch() missing 1 required positional argument: 'self'
Traceback (most recent call last):
  File "/tmp/gl/bin/p2o.py", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/jgb/src/jgbarah/GrimoireELK/utils/p2o.py", line 73, in <module>
    args.arthur)
  File "/home/jgb/src/jgbarah/mordred/grimoire_elk/arthur.py", line 219, in feed_backend
    unique_id = es_index + "_" + backend.origin
TypeError: Can't convert 'property' object to str implicitly

Any idea?

@jgbarah jgbarah changed the title New perceval seems to break grimoire_elk Latest perceval seems to break grimoire_elk Feb 25, 2018
@jgbarah jgbarah added the bug label Feb 25, 2018
@sduenas
Copy link
Member

sduenas commented Feb 26, 2018

Latest version of Perceval does not create an instance of a backend for a given BackendCommand class. This instance is created when the command is run and not during the object initialization.
Moreover, GELK code needs an instance of a backend and not the backend class. That's what Backend.BACKEND is: a class object and not an instance.

The issue #225 will try to fix this problem, refactorizing how Perceval is used within GELK.

@sduenas
Copy link
Member

sduenas commented Mar 15, 2018

Fixed by #227

@sduenas sduenas closed this as completed Mar 15, 2018
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

2 participants