{ "cells": [ { "cell_type": "code", "execution_count": 1, "outputs": [], "source": [ "import os" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 2, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[DATABASE]\n", "user = root\n", "pwd = happylay\n", "db_name = datax_web_dev\n", "host = 192.168.199.107\n", "port = 10086\n", "\n", "[MINIO]\n", "url = minio-api.sxkj.com\n", "k8s_url=minio.default:9000\n", "access_key = admin\n", "secret_key = sxkjadmin\n", "\n", "\n", "[AF_BACKEND]\n", "uri=192.168.199.109:18082\n", "host=192.168.199.109\n", "port=18082\n", "dag_files_dir=/dags/\n", "\n", "[BACKEND]\n", "url=192.168.199.107:18082\n", "\n", "[K8S]\n", ";image_pull_key=codingregistrykey\n", "enable_kerberos=true\n", "\n", "[AIRFLOW]\n", "uri=192.168.199.109\n", "host_in_header=airflow-web.sxkj.com\n", "api_token=YWRtaW46YWRtaW4=\n", "\n", "[HIVE]\n", "host = 192.168.199.27\n", "port = 10000\n", "username = hive\n", "password = hive\n", "database_name = default\n", "kerberos=0\n", "\n", "[HIVE_METASTORE]\n", "uris=thrift://192.168.199.27:9083\n", "\n", "\n", "[TASK_IMAGES]\n", "datax=SXKJ:32775/pod_datax:0.9\n", "python=SXKJ:32775/pod_python:1.1\n", "java=SXKJ:32775/java:1.0\n", "sparks=SXKJ:32775/jupyter:0.96\n", "\n", "get config of development\n", "192.168.199.107\n" ] } ], "source": [ "os.environ['APP_ENV']='development'\n", "from configs.settings import config\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 5, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "print ( type(config.get('K8S', 'enable_kerberos', fallback=None)))" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 4, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1\n" ] } ], "source": [ "print (config.get('K8S', 'image_pull_key',fallback=1))" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 7, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "cd /workspace && echo \"$SCRIPT\" > run.py && ${SPARK_HOME}/bin/spark-submit --name spark_94_aN6SiQdZ8a7OPhnhPKnJU --master yarn --deploy-mode cluster --driver-memory 1g --driver-cores 1 --executor-memory 1g --executor-cores 1 --num-executors 1 --archives /workspace/py37.zip#python3env --conf spark.default.parallelism=1 --conf spark.executor.memoryOverhead=1g --conf spark.driver.memoryOverhead=1g --conf spark.yarn.maxAppAttempts=1 --conf spark.yarn.submit.waitAppCompletion=true --conf spark.pyspark.driver.python=python3env/py37/bin/python --conf spark.yarn.appMasterEnv.PYSPARK_PYTHON=python3env/py37/bin/python --conf spark.pyspark.python=python3env/py37/bin/python run.py\n" ] } ], "source": [ "print('cd /workspace && echo \"$SCRIPT\" > run.py && ${SPARK_HOME}/bin/spark-submit --name spark_94_aN6SiQdZ8a7OPhnhPKnJU --master yarn --deploy-mode cluster --driver-memory 1g --driver-cores X 1 --executor-memory 1g --executor-cores 1 --num-executors 1 --archives /workspace/py37.zip#python3env --conf spark.default.parallelism=1 --conf spark.executor.memoryOverhead=1g --conf spark.driver.memoryOverhead=1g --conf spark.yarn.maxAppAttempts=1 --conf spark.yarn.submit.waitAppCompletion=true --conf spark.pyspark.driver.python=python3env/py37/bin/python --conf spark.yarn.appMasterEnv.PYSPARK_PYTHON=python3env/py37/bin/python --conf spark.pyspark.python=python3env/py37/bin/python run.py')" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 2, "outputs": [], "source": [ "datetime_str = '2022-09-02T00:00:00+00:00'" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 3, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1662076800.0\n" ] } ], "source": [ "import datetime\n", "try:\n", " print(datetime.datetime.strptime(datetime_str,'%Y-%m-%dT%H:%M:%S%z').timestamp() if datetime_str else datetime_str)\n", "except Exception:\n", " print(datetime.datetime.strptime(datetime_str,'%Y-%m-%dT%H:%M:%S.%f%z').timestamp() if datetime_str else datetime_str)\n" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 1, "outputs": [ { "data": { "text/plain": "'10'" }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "str(10)" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": null, "outputs": [], "source": [], "metadata": { "collapsed": false } } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }