Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
elasticsearch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
cubes
elasticsearch
Commits
da3ef51e1b4e
Commit
da3ef51e1b4e
authored
8 years ago
by
David Douard
Browse files
Options
Downloads
Patches
Plain Diff
[ccplugin] flake8
parent
a420b5c0c8b1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ccplugin.py
+30
-28
30 additions, 28 deletions
ccplugin.py
with
30 additions
and
28 deletions
ccplugin.py
+
30
−
28
View file @
da3ef51e
...
...
@@ -2,7 +2,7 @@
"""
cubicweb-ctl plugin providing the index-in-es command
:organization: Logilab
:copyright: 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:copyright: 2016
-2017
LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
from
__future__
import
print_function
...
...
@@ -18,8 +18,6 @@
from
cubes.elasticsearch.es
import
indexable_types
,
fulltext_indexable_rql
__docformat__
=
"
restructuredtext en
"
HERE
=
osp
.
dirname
(
osp
.
abspath
(
__file__
))
...
...
@@ -34,21 +32,26 @@
name
=
'
index-in-es
'
min_args
=
max_args
=
1
arguments
=
'
<instance id>
'
options
=
[(
'
dry-run
'
,
{
'
type
'
:
'
yn
'
,
'
default
'
:
False
,
'
help
'
:
'
set to True if you want to skip the insertion in ES
'
}),
(
'
debug
'
,
{
'
type
'
:
'
yn
'
,
'
default
'
:
False
,
'
help
'
:
'
set to True if you want to print
'
'
out debug info and progress
'
}),
(
'
etypes
'
,
{
'
type
'
:
'
csv
'
,
'
default
'
:
''
,
'
help
'
:
'
only index given etypes
'
'
[default:all indexable types]
'
}),
(
'
index-name
'
,
{
'
type
'
:
'
string
'
,
'
default
'
:
''
,
'
help
'
:
'
override index-name if you want to use a different ID
'
'
[default: uses index-name from all-in-one.conf]
'
}),
(
'
except-etypes
'
,
{
'
type
'
:
'
string
'
,
'
default
'
:
''
,
'
help
'
:
'
all indexable types except given etypes
'
'
[default: []]
'
}),
]
options
=
[
(
'
dry-run
'
,
{
'
type
'
:
'
yn
'
,
'
default
'
:
False
,
'
help
'
:
'
set to True if you want to skip the insertion in ES
'
}),
(
'
debug
'
,
{
'
type
'
:
'
yn
'
,
'
default
'
:
False
,
'
help
'
:
(
'
set to True if you want to print
'
'
out debug info and progress
'
)}),
(
'
etypes
'
,
{
'
type
'
:
'
csv
'
,
'
default
'
:
''
,
'
help
'
:
'
only index given etypes [default:all indexable types]
'
}),
(
'
index-name
'
,
{
'
type
'
:
'
string
'
,
'
default
'
:
''
,
'
help
'
:
(
'
override index-name if you want to use a different ID
'
'
[default: uses index-name from all-in-one.conf]
'
)}),
(
'
except-etypes
'
,
{
'
type
'
:
'
string
'
,
'
default
'
:
''
,
'
help
'
:
'
all indexable types except given etypes
'
'
[default: []]
'
}),
]
def
run
(
self
,
args
):
"""
run the command with its specific arguments
"""
...
...
@@ -64,9 +67,9 @@
if
self
.
config
.
etypes
:
etypes
=
self
.
config
.
etypes
else
:
etypes
=
indexable_types
(
schema
,
custom_skip_list
=
self
.
config
.
except_etypes
)
etypes
=
indexable_types
(
schema
,
custom_skip_list
=
self
.
config
.
except_etypes
)
assert
self
.
config
.
except_etypes
not
in
etypes
if
self
.
config
.
debug
and
not
self
.
config
.
etypes
:
print
(
u
'
found indexable_types {}
'
.
format
(
'
,
'
.
join
(
etypes
)))
...
...
@@ -69,15 +72,14 @@
assert
self
.
config
.
except_etypes
not
in
etypes
if
self
.
config
.
debug
and
not
self
.
config
.
etypes
:
print
(
u
'
found indexable_types {}
'
.
format
(
'
,
'
.
join
(
etypes
)))
for
_
in
parallel_bulk
(
es
,
self
.
bulk_actions
(
etypes
,
cnx
,
index_name
=
self
.
config
.
index_name
,
dry_run
=
self
.
config
.
dry_run
),
raise_on_error
=
False
,
raise_on_exception
=
False
):
pass
for
_
in
parallel_bulk
(
es
,
self
.
bulk_actions
(
etypes
,
cnx
,
index_name
=
self
.
config
.
index_name
,
dry_run
=
self
.
config
.
dry_run
),
raise_on_error
=
False
,
raise_on_exception
=
False
):
pass
else
:
if
self
.
config
.
debug
:
print
(
u
'
no elasticsearch configuration found, skipping
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment