diff options
| author | bnewbold <bnewbold@archive.org> | 2022-01-21 23:19:35 +0000 | 
|---|---|---|
| committer | bnewbold <bnewbold@archive.org> | 2022-01-21 23:19:35 +0000 | 
| commit | 04b5d02a3dad37d66a73afb7ea6bf9c7a78427dd (patch) | |
| tree | 939ed5f3f7f9e7480de8e3a447f1af7adcf81165 /python/fatcat_worker.py | |
| parent | 33578b36552e62a3fc892a5f3e59eab3fd68ad24 (diff) | |
| parent | bf0c7ece06735d5568f4a89d2006c4cc0a37cdcf (diff) | |
| download | fatcat-04b5d02a3dad37d66a73afb7ea6bf9c7a78427dd.tar.gz fatcat-04b5d02a3dad37d66a73afb7ea6bf9c7a78427dd.zip  | |
Merge branch 'bnewbold-file-es' into 'master'
File entity elasticsearch index worker
See merge request webgroup/fatcat!136
Diffstat (limited to 'python/fatcat_worker.py')
| -rwxr-xr-x | python/fatcat_worker.py | 28 | 
1 files changed, 28 insertions, 0 deletions
diff --git a/python/fatcat_worker.py b/python/fatcat_worker.py index a49263ac..a7dcf755 100755 --- a/python/fatcat_worker.py +++ b/python/fatcat_worker.py @@ -10,6 +10,7 @@ from fatcat_tools.workers import (      ChangelogWorker,      ElasticsearchChangelogWorker,      ElasticsearchContainerWorker, +    ElasticsearchFileWorker,      ElasticsearchReleaseWorker,      EntityUpdatesWorker,  ) @@ -70,6 +71,17 @@ def run_elasticsearch_container(args: argparse.Namespace) -> None:      worker.run() +def run_elasticsearch_file(args: argparse.Namespace) -> None: +    consume_topic = "fatcat-{}.file-updates".format(args.env) +    worker = ElasticsearchFileWorker( +        args.kafka_hosts, +        consume_topic, +        elasticsearch_backend=args.elasticsearch_backend, +        elasticsearch_index=args.elasticsearch_index, +    ) +    worker.run() + +  def run_elasticsearch_changelog(args: argparse.Namespace) -> None:      consume_topic = "fatcat-{}.changelog".format(args.env)      worker = ElasticsearchChangelogWorker( @@ -150,6 +162,22 @@ def main() -> None:          help="whether to query release search index for container stats",      ) +    sub_elasticsearch_file = subparsers.add_parser( +        "elasticsearch-file", +        help="consume kafka feed of new/updated files, transform and push to search", +    ) +    sub_elasticsearch_file.set_defaults(func=run_elasticsearch_file) +    sub_elasticsearch_file.add_argument( +        "--elasticsearch-backend", +        help="elasticsearch backend to connect to", +        default="http://localhost:9200", +    ) +    sub_elasticsearch_file.add_argument( +        "--elasticsearch-index", +        help="elasticsearch index to push into", +        default="fatcat_file", +    ) +      sub_elasticsearch_changelog = subparsers.add_parser(          "elasticsearch-changelog",          help="consume changelog kafka feed, transform and push to search",  | 
