delete mysql storage and use config file store data

Change-Id: I0785cf2c7c0d828d653bd6f20f3e804275014f99
This commit is contained in:
jiasirui 2021-05-11 13:53:40 +08:00
parent 9c01bf17db
commit 4f7515ed2e
25 changed files with 11 additions and 775 deletions

View File

@ -20,8 +20,8 @@ os_region_name = RegionOne
osapi_venus_listen_port = 10010
osapi_venus_workers = 1
[database]
connection = mysql+pymysql://root:secret@localhost:3306/venus?charset=utf8
[elasticsearch]
url = http://localhost:9200
es_index_days =30
username = esuser
password = espass

View File

@ -22,14 +22,9 @@ import os
import sys
from oslo_config import cfg
from oslo_db.sqlalchemy import migration
from oslo_log import log as logging
from venus.conf import CONF
from venus import context
from venus import db
from venus.db import migration as db_migration
from venus.db.sqlalchemy import api as db_api
from venus import i18n
from venus.i18n import _
from venus import objects
@ -127,36 +122,6 @@ def _db_error(caught_exception):
exit(1)
class DbCommands(object):
"""Class for managing the database."""
def __init__(self):
pass
@args('version', nargs='?', default=None,
help='Database version')
def sync(self, version=None):
"""Sync the database up to the most recent version."""
return db_migration.db_sync(version)
def version(self):
"""Print the current database version."""
print(migration.db_version(db_api.get_engine(),
db_migration.MIGRATE_REPO_PATH,
db_migration.INIT_VERSION))
@args('age_in_days', type=int,
help='Purge deleted rows older than age in days')
def purge(self, age_in_days):
"""Purge deleted rows older than a given age from venus tables."""
age_in_days = int(age_in_days)
if age_in_days <= 0:
print(_("Must supply a positive, non-zero value for age"))
exit(1)
ctxt = context.get_admin_context()
db.purge_deleted_rows(ctxt, age_in_days)
class VersionCommands(object):
"""Class for exposing the codebase version."""
@ -257,7 +222,6 @@ class TaskCommands(object):
CATEGORIES = {
'config': ConfigCommands,
'db': DbCommands,
'logs': GetLogCommands,
'shell': ShellCommands,
'version': VersionCommands,

View File

@ -26,7 +26,10 @@ elasticsearch_opts = [
help='the es username'),
cfg.StrOpt('password',
default='',
help='the es password')
help='the es password'),
cfg.IntOpt('es_index_days',
default=30,
help='the es log store days')
]

View File

@ -1,18 +0,0 @@
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
DB abstraction for Venus
"""

View File

@ -1,31 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Base class for classes that need modular database access."""
from oslo_utils import importutils
from venus.conf import CONF
class Base(object):
"""DB driver is injected in the init method."""
def __init__(self, db_driver=None):
# NOTE(mriedem): Without this call, multiple inheritance involving
# the db Base class does not work correctly.
super(Base, self).__init__()
if not db_driver:
db_driver = CONF.db_driver
self.db = importutils.import_module(db_driver) # pylint: disable=C0103
self.db.dispose_engine()

View File

@ -1,45 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Implementation of SQLAlchemy backend."""
import osprofiler.sqlalchemy
import sqlalchemy
import threading
from oslo_db.sqlalchemy import session as db_session
from venus.conf import CONF
_LOCK = threading.Lock()
_FACADE = None
def _create_facade_lazily():
global _LOCK
with _LOCK:
global _FACADE
if _FACADE is None:
_FACADE = db_session.EngineFacade(
CONF.database.connection,
**dict(CONF.database)
)
if CONF.profiler.profiler_enabled:
if CONF.profiler.trace_sqlalchemy:
osprofiler.sqlalchemy.add_tracing(sqlalchemy,
_FACADE.get_engine(),
"db")
return _FACADE

View File

@ -1,57 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Database setup and migration commands."""
import os
import threading
from oslo_config import cfg
from oslo_db import options as db_options
from oslo_db.sqlalchemy.migration import db_sync as sync
from oslo_db.sqlalchemy import session as db_session
INIT_VERSION = 000
_IMPL = None
_LOCK = threading.Lock()
db_options.set_defaults(cfg.CONF)
MIGRATE_REPO_PATH = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'sqlalchemy/migrate_repo',
)
def get_engine():
print(cfg.CONF)
global _IMPL
if _IMPL is None:
with _LOCK:
if _IMPL is None:
_IMPL = db_session.EngineFacade(
cfg.CONF.database.connection,
**dict(cfg.CONF.database)
)
return _IMPL.get_engine()
def db_sync(version=None, init_version=INIT_VERSION, engine=None):
"""Migrate the database to `version` or the most recent version."""
engine = get_engine()
return sync(engine=engine,
abs_path=MIGRATE_REPO_PATH,
version=version,
init_version=init_version)

View File

@ -1,133 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Implementation of SQLAlchemy backend."""
import sys
import warnings
from oslo_db import options
from venus.conf import CONF
from venus.db.common import _create_facade_lazily
from venus import exception
from venus.i18n import _
CONF.import_group("profiler", "venus.service")
options.set_defaults(CONF, connection='sqlite:///$state_path/venus.sqlite')
def get_engine():
facade = _create_facade_lazily()
return facade.get_engine()
def get_session(**kwargs):
facade = _create_facade_lazily()
return facade.get_session(**kwargs)
def dispose_engine():
get_engine().dispose()
_DEFAULT_QUOTA_NAME = 'default'
def get_backend():
"""The backend is this module itself."""
return sys.modules[__name__]
def is_admin_context(context):
"""Indicates if the request context is an administrator."""
if not context:
warnings.warn(_('Use of empty request context is deprecated'),
DeprecationWarning)
raise Exception('die')
return context.is_admin
def is_user_context(context):
"""Indicates if the request context is a normal user."""
if not context:
return False
if context.is_admin:
return False
if not context.user_id or not context.project_id:
return False
return True
def authorize_project_context(context, project_id):
"""Ensures a request has permission to access the given project."""
if is_user_context(context):
if not context.project_id:
raise exception.NotAuthorized()
elif context.project_id != project_id:
raise exception.NotAuthorized()
def authorize_user_context(context, user_id):
"""Ensures a request has permission to access the given user."""
if is_user_context(context):
if not context.user_id:
raise exception.NotAuthorized()
elif context.user_id != user_id:
raise exception.NotAuthorized()
def authorize_quota_class_context(context, class_name):
"""Ensures a request has permission to access the given quota class."""
if is_user_context(context):
if not context.quota_class:
raise exception.NotAuthorized()
elif context.quota_class != class_name:
raise exception.NotAuthorized()
def require_admin_context(f):
"""Decorator to require admin request context.
The first argument to the wrapped function must be the context.
"""
def wrapper(*args, **kwargs):
if not is_admin_context(args[0]):
raise exception.AdminRequired()
return f(*args, **kwargs)
return wrapper
def require_context(f):
"""Decorator to require *any* user or admin context.
This does no authorization for user or project access matching, see
:py:func:`authorize_project_context` and
:py:func:`authorize_user_context`.
The first argument to the wrapped function must be the context.
"""
def wrapper(*args, **kwargs):
if not is_admin_context(args[0]) and not is_user_context(args[0]):
raise exception.NotAuthorized()
return f(*args, **kwargs)
return wrapper

View File

@ -1,4 +0,0 @@
This is a database migration repository.
More information at
http://code.google.com/p/sqlalchemy-migrate/

View File

@ -1,24 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from migrate.versioning.shell import main
from venus.db.sqlalchemy import migrate_repo
if __name__ == '__main__':
main(debug='False',
repository=os.path.abspath(os.path.dirname(migrate_repo.__file__)))

View File

@ -1,20 +0,0 @@
[db_settings]
# Used to identify which repository this database is versioned under.
# You can use the name of your project.
repository_id=venus
# The name of the database table used to track the schema version.
# This name shouldn't already be used by your project.
# If this is changed once a database is under version control, you'll need to
# change the table name in each database too.
version_table=migrate_version
# When committing a change script, Migrate will attempt to generate the
# sql for all supported databases; normally, if one of them fails - probably
# because you don't have that database installed - it is ignored and the
# commit continues, perhaps ending successfully.
# Databases in this list MUST compile successfully during a commit, or the
# entire commit will fail. List the databases your application will actually
# be using to ensure your updates to that database work properly.
# This must be a list; example: ['postgres','sqlite']
required_dbs=[]

View File

@ -1,85 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""WSGI Routers for the Identity service."""
import sqlalchemy as sql
from sqlalchemy.orm import sessionmaker
def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
t_mo_regitster_task = sql.Table(
't_mo_regitster_task',
meta,
sql.Column('Id', sql.Integer, nullable=False,
primary_key=True),
sql.Column('task_name', sql.String(255), nullable=True,
primary_key=False),
sql.Column('host_name', sql.String(255), nullable=True,
primary_key=False),
sql.Column('update_time', sql.DateTime, nullable=True,
primary_key=False, default='0000-00-00 00:00:00'),
sql.Column('created_at', sql.DateTime,
nullable=True, primary_key=False),
sql.Column('updated_at', sql.DateTime,
nullable=True, primary_key=False),
sql.Column('deleted', sql.String(1),
nullable=True, primary_key=False),
sql.Column('deleted_at', sql.DateTime,
nullable=True, primary_key=False),
mysql_engine='InnoDB',
mysql_charset='utf8')
t_mo_regitster_task.create(migrate_engine, checkfirst=True)
new_data = {
'Id': '1',
'task_name': 'delete_es_index',
'host_name': '',
'update_time': '1900-01-01 00:00:00'
}
maker = sessionmaker(bind=migrate_engine)
session = maker()
t_mo_regitster_task = sql.Table('t_mo_regitster_task', meta, autoload=True)
row = t_mo_regitster_task.insert().values(**new_data)
session.execute(row)
session.commit()
t_mo_custom_config = sql.Table(
't_mo_custom_config',
meta,
sql.Column('id', sql.String(64), primary_key=True),
sql.Column('value', sql.String(10240), nullable=False),
sql.Column('update_time', sql.DateTime),
mysql_engine='InnoDB',
mysql_charset='utf8')
t_mo_custom_config.create(migrate_engine, checkfirst=True)
new_data = {
'id': 'es_index_length',
'value': '30',
'update_time': '1900-01-01 00:00:00'
}
maker = sessionmaker(bind=migrate_engine)
session = maker()
t_mo_custom_config = sql.Table('t_mo_custom_config', meta, autoload=True)
row = t_mo_custom_config.insert().values(**new_data)
session.execute(row)
session.commit()
session.close()

View File

@ -1,29 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from venus.modules.custom_config.backends.sql import CustomConfigSql
class CustomConfigCore(object):
def __init__(self):
self.config_sql = CustomConfigSql()
super(CustomConfigCore, self).__init__()
def get_config(self, id):
res = dict()
res["value"] = self.config_sql.get_config(id)
return res
def set_config(self, id, value):
return self.config_sql.set_config(id, value)

View File

@ -1,72 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
SQLAlchemy models for venus data.
"""
from oslo_db.sqlalchemy import models
from oslo_utils import timeutils
from sqlalchemy import Column
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import DateTime, String
from venus.conf import CONF
BASE = declarative_base()
class VenusBase(models.TimestampMixin,
models.ModelBase):
"""Base class for Venus Models."""
__table_args__ = {'mysql_engine': 'InnoDB'}
# TODO(rpodolyaka): reuse models.SoftDeleteMixin in the next stage
# of implementing of BP db-cleanup
created_at = Column(DateTime)
updated_at = Column(DateTime)
deleted_at = Column(DateTime)
# deleted = Column(Boolean, default=False)
deleted = Column(String(1), default=0)
metadata = None
def delete(self, session):
"""Delete this object."""
self.deleted = True
self.deleted_at = timeutils.utcnow()
self.save(session=session)
def register_models():
"""Rvenuster Models and create metadata.
Called from venus.db.sqlalchemy.__init__ as part of loading the driver,
it will never need to be called explicitly elsewhere unless the
connection is lost and needs to be reestablished.
"""
from sqlalchemy import create_engine
models = ()
engine = create_engine(CONF.database.connection, echo=False)
for model in models:
model.metadata.create_all(engine)
class CustomConfig(BASE):
__tablename__ = 't_mo_custom_config'
id = Column(String(64), primary_key=True)
value = Column(String(10240))
update_time = Column(DateTime())

View File

@ -1,61 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Implementation of SQLAlchemy backend."""
import time
from oslo_db import options
from venus.conf import CONF
from venus.db.common import _create_facade_lazily
from venus.modules.custom_config.backends import models
CONF.import_group("profiler", "venus.service")
options.set_defaults(CONF, connection='sqlite:///$state_path/venus.sqlite')
def get_session(**kwargs):
facade = _create_facade_lazily()
return facade.get_session(**kwargs)
class CustomConfigSql(object):
def get_config(self, id):
session = get_session()
with session.begin():
config = session.query(models.CustomConfig).filter_by(
id=id).first()
if config is None:
return None
else:
return config.value
def set_config(self, id, value):
session = get_session()
with session.begin():
config = session.query(models.CustomConfig).filter_by(
id=id).first()
if config is None:
s_instance = models.CustomConfig(
id=id,
value=value,
update_time=time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(time.time())))
session.add(s_instance)
else:
config.value = value
config.update_time = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(time.time()))

View File

@ -15,27 +15,17 @@
"""The template api."""
from venus.api.openstack import wsgi
from venus.modules.custom_config.action import CustomConfigCore
from venus.conf import CONF
class CustomConfigController(wsgi.Controller):
def __init__(self, ext_mgr):
self.ext_mgr = ext_mgr
self.config_api = CustomConfigCore()
super(CustomConfigController, self).__init__()
@wsgi.wrap_check_policy
def get_config(self, req):
id = req.params.get("id", None)
text = self.config_api.get_config(id)
return text
@wsgi.wrap_check_policy
def set_config(self, req, body):
id = body.get("id", None)
value = body.get("value", None)
text = self.config_api.set_config(id, value)
return text
return CONF.elasticsearch.es_index_days
def create_resource(ext_mgr):

View File

@ -1,69 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
SQLAlchemy models for venus data.
"""
from oslo_db.sqlalchemy import models
from oslo_utils import timeutils
from sqlalchemy import Column
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import DateTime, String
from venus.conf import CONF
BASE = declarative_base()
class VenusBase(models.TimestampMixin,
models.ModelBase):
"""Base class for Venus Models."""
__table_args__ = {'mysql_engine': 'InnoDB'}
# TODO(rpodolyaka): reuse models.SoftDeleteMixin in the next stage
# of implementing of BP db-cleanup
created_at = Column(DateTime)
updated_at = Column(DateTime)
deleted_at = Column(DateTime)
deleted = Column(String(1), default=0)
metadata = None
def delete(self, session):
"""Delete this object."""
self.deleted = True
self.deleted_at = timeutils.utcnow()
self.save(session=session)
def register_models():
"""Rvenuster Models and create metadata.
Called from venus.db.sqlalchemy.__init__ as part of loading the driver,
it will never need to be called explicitly elsewhere unless the
connection is lost and needs to be reestablished.
"""
from sqlalchemy import create_engine
models = ()
engine = create_engine(CONF.database.connection, echo=False)
for model in models:
model.metadata.create_all(engine)
class RegitsterTask(BASE, VenusBase):
__tablename__ = 't_mo_regitster_task'
Id = Column(String(11), primary_key=True)
task_name = Column(String(255))
host_name = Column(String(255))
update_time = Column(DateTime())

View File

@ -1,64 +0,0 @@
# Copyright 2020 Inspur
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Implementation of SQLAlchemy backend."""
import socket
import time
from oslo_db import options
from venus.common.utils import LOG
from venus.conf import CONF
from venus.db.common import _create_facade_lazily
from venus.i18n import _LE
from venus.task.backends import models
# abc
CONF.import_group("profiler", "venus.service")
options.set_defaults(CONF, connection='sqlite:///$state_path/venus.sqlite')
def get_session(**kwargs):
facade = _create_facade_lazily()
return facade.get_session(**kwargs)
class TaskSql(object):
def check_task(self, t_name):
session = get_session()
with session.begin():
hostname = socket.gethostname()
now = time.time()
tasks = session.query(models.RegitsterTask).filter_by(
task_name=t_name).with_lockmode('update').all()
if len(tasks) != 1:
LOG.error(_LE("unsupported task type:%s, please check it"),
t_name)
return False
if tasks[0].update_time is None or (now - time.mktime(
time.strptime(str(tasks[0].update_time),
'%Y-%m-%d %H:%M:%S'))) > 600:
tasks[0].host_name = hostname
tasks[0].update_time = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(now))
res = True
else:
if tasks[0].host_name == hostname:
tasks[0].update_time = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(now))
res = True
else:
res = False
return res

View File

@ -18,10 +18,8 @@ import time
from venus.common import utils
from venus.common.utils import LOG
from venus.conf import CONF
from venus.modules.custom_config.backends.sql import CustomConfigSql
from venus.modules.search.search_lib import ESSearchObj
from venus.i18n import _LE, _LI
from venus.task.backends.sql import TaskSql
TASK_NAME = "delete_es_index"
@ -32,8 +30,6 @@ class DeleteESIndexTask(object):
def __init__(self):
self.elasticsearch_url = CONF.elasticsearch.url
self.custom_sql = CustomConfigSql()
self.task_sql = TaskSql()
self.search_lib = ESSearchObj()
def delete_index(self, name):
@ -44,7 +40,7 @@ class DeleteESIndexTask(object):
return
def delete_es_history_index(self):
len_d = self.custom_sql.get_config("es_index_length")
len_d = CONF.elasticsearch.es_index_days
LOG.info("the elasticsearch indexes keep days {}".format(len_d))
if len_d is None:
LOG.error(_LE("es_index_length no exist"))
@ -67,11 +63,6 @@ class DeleteESIndexTask(object):
def start_task(self):
try:
LOG.info(_LI("delete es index task started"))
ret = self.task_sql.check_task(TASK_NAME)
if ret is not True:
LOG.info(_LI("delete es index task not need execute"))
return
if CONF.elasticsearch.url == "":
LOG.info(_LI("not deploy es and not need execute"))

View File

@ -31,4 +31,4 @@ def init_advanced_timer():
def add_jobs():
sched.add_job(adapter.delete_es_index_job, TRIGGER_INTERVAL,
hours=1, id='delete_es_index_job')
seconds=10, id='delete_es_index_job')