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

Sync data from S3 directly in GraphImporterTask #355

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fridex
Copy link
Contributor

@fridex fridex commented Sep 25, 2017

No description provided.

@fridex fridex force-pushed the gremlin-sync branch 2 times, most recently from 7037153 to a46ab40 Compare September 25, 2017 14:09
@msrb
Copy link
Member

msrb commented Sep 26, 2017

[test]

for task_name in tasks_to_sync:
if version_level:
task_result = s3.retrieve_task_result(task_name=task_name, **adapter_kwargs)
gremlin.store_task_result(task_name=task_name, task_result=task_result, **adapter_kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the if not version_level case ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! The if-clause shouldn't be there.

@miteshvp
Copy link
Contributor

miteshvp commented Oct 3, 2017

@fridex - I guess lot of this code is already covered in #335. Do you want to add other files especially graph_populator and graph_importer_utils from there or I can modify graph_importer based on this one. Also, one query, will this be able to list keys like <ecosystem>/<package>/<version>.json, because graph meta such as latest_version is collected from here.

@fridex
Copy link
Contributor Author

fridex commented Oct 3, 2017

@fridex - I guess lot of this code is already covered in #335. Do you want to add other files especially graph_populator and graph_importer_utils from there or I can modify graph_importer based on this one. Also, one query, will this be able to list keys like //.json, because graph meta such as latest_version is collected from here.

This should handle logic from task execution side. You can directly use this PR (changes from maintainers are allowed). Feel free to add missing files and logic.

object_key = self._construct_base_file_name(arguments)
bucket = self._s3.Bucket(self.bucket_name)
objects = bucket.objects.filter(Prefix=object_key)
return list(x.key for x in objects if x.key.endswith('.json'))
Copy link
Contributor Author

@fridex fridex Oct 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miteshvp This will probably list task results with the whole object key ("path"). If you don't want to do it that way, feel free to adjust to return only task name.

EDIT: it will be probably needed anyway as this is handled by adapter.

@miteshvp
Copy link
Contributor

miteshvp commented Oct 3, 2017

This should handle logic from task execution side. You can directly use this PR (changes from maintainers are allowed). Feel free to add missing files and logic.

@fridex in that case, WDYT of moving graph_importer version of this PR over to #335 rather than pulling all the other code here. Because apart from that, the adapter functionality is almost the same. Maybe you can give it another look there.

@fridex
Copy link
Contributor Author

fridex commented Oct 9, 2017

This should handle logic from task execution side. You can directly use this PR (changes from maintainers are allowed). Feel free to add missing files and logic.

@fridex in that case, WDYT of moving graph_importer version of this PR over to #335 rather than pulling all the other code here. Because apart from that, the adapter functionality is almost the same. Maybe you can give it another look there.

I wanted to provide a template for better fit to core. If you are fine with maintaining this code, feel free to proceed with merge (please rebase in that case).

@miteshvp
Copy link
Contributor

@fridex - can you rebase this. LGTM, so that I can start working from where you left.

@fridex
Copy link
Contributor Author

fridex commented Oct 18, 2017

@fridex - can you rebase this. LGTM, so that I can start working from where you left.

I wouldn't merge this as this is a partial change. If we decide to deploy a new worker (e.g. due to intent API) and this change will be in, we will not sync anything to graph - changes that go in should be complete.

I can rebase (heading to office). BTW you can still collaborate and push/rebase your changes. Changes by collaborators are enabled on github.

@miteshvp
Copy link
Contributor

I wouldn't merge this as this is a partial change. If we decide to deploy a new worker (e.g. due to intent API) and this change will be in, we will not sync anything to graph - changes that go in should be complete.

We will not modify the flows currently. So we should be safe. Once we test this thoroughly then we can change the flow. WDYT?

@fridex
Copy link
Contributor Author

fridex commented Oct 18, 2017

We will not modify the flows currently. So we should be safe. Once we test this thoroughly then we can change the flow. WDYT?

There is no modification of flows but there is amended GraphImporterTask itself that does not sync to graph in this PR rather it prints when/what is to be synced - only the sync part is missing - see https://github.com/fabric8-analytics/fabric8-analytics-worker/pull/355/files#diff-e7dcb5077b1c810edbe3839d1708dd73R14 and https://github.com/fabric8-analytics/fabric8-analytics-worker/pull/355/files#diff-e7dcb5077b1c810edbe3839d1708dd73R21

So if we merge this, there will not be any sync done.

@fridex
Copy link
Contributor Author

fridex commented Oct 18, 2017

@miteshvp I did rebase for you, feel free to continue in this PR by pushing commits.

@miteshvp
Copy link
Contributor

@fridex thanks. I will work on this branch. Push the commits here directly.

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

Successfully merging this pull request may close these issues.

4 participants