liuyonghengheng commented on a change in pull request #9149: URL: https://github.com/apache/airflow/pull/9149#discussion_r453295020
########## File path: airflow/providers/apache/kylin/operators/kylin.py ########## @@ -0,0 +1,171 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 time +from datetime import datetime +from typing import Optional + +from kylinpy import kylinpy + +from airflow.exceptions import AirflowException +from airflow.models import BaseOperator +from airflow.providers.apache.kylin.hooks.kylin import KylinHook +from airflow.utils import timezone +from airflow.utils.decorators import apply_defaults + + +class KylinOperator(BaseOperator): + """ + This operator is used to submit request about kylin build/refresh/merge, + and can track jobs' status . so users can easier to build kylin job + + For more detail information in + `Apache Kylin <http://kylin.apache.org/>`_ + + :param kylin_conn_id: The connection id as configured in Airflow administration. + :type kylin_conn_id: str + :param project: kylin porject name, this param will overwrite the project in kylin_conn_id: + :type project: str + :param cube: kylin cube name + :type cube: str + :param dsn: (dsn , dsn url of kylin connection ,which will overwrite kylin_conn_id. + for example: kylin://ADMIN:KYLIN@sandbox/learn_kylin?timeout=60&is_debug=1) + :type dsn: str + :param command: (kylin command include 'build', 'merge', 'refresh', 'delete', + 'build_streaming', 'merge_streaming', 'refresh_streaming', 'disable', 'enable', + 'purge', 'clone', 'drop'. + build - use /kylin/api/cubes/{cubeName}/build rest api,and buildType is ‘BUILD’, + and you should give start_time and end_time + refresh - use build rest api,and buildType is ‘REFRESH’ + merge - use build rest api,and buildType is ‘MERGE’ + build_streaming - use /kylin/api/cubes/{cubeName}/build2 rest api,and buildType is ‘BUILD’ + build_streaming - use build2 rest api,and buildType is ‘BUILD’, + and you should give offset_start and offset_end + build_streaming - use build2 rest api,and buildType is ‘REFRESH’ + build_streaming - use build2 rest api,and buildType is ‘MERGE’ Review comment: Thank you very much Xiaoxiang, I'll fix it right away ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
