{ "info": { "author": "elkan1788", "author_email": "elkan1788@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: Chinese (Simplified)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: Implementation", "Topic :: Software Development :: Libraries" ], "description": "Email Job[With Hive Server Query]\n=================================\n\nIt's a powerful component help us send customer's special detail data through email attachments.\n\nUser Guide\n==========\n\n1. Ready some configure files\n------------------------------\n\n.. code-block::\n\n # /etc/pythoncfg/hive.ini\n\n [HiveServer]\n host=127.0.0.1\n port=10000\n user=hive\n db=default\n\n # /etc/pythoncfg/email.ini\n\n [EmailServer]\n server=mail.163.com\n port=25\n user=elkan1788@gmail.com\n passwd=xxxxxx\n mode=TSL\n\n\n> Please replace the secure info of your. Kind like Hive Server host and email SMTP server user password.\n\n2. Ready your job info configure file\n--------------------------------------\n\n_**Example:**_\n.. code-block::\n\n [JobInfo]\n title=\u90ae\u4ef6\u62a5\u8868\u4efb\u52a1\u6d4b\u8bd5\n\n [CSVFolder]\n folder=/opt/csv_files/\n\n # Please notice that CSVFile,CSVHead,HQLScript must be same length.\n # And suggest that use prefix+number to flag and write.\n [CSVFile]\n file1=\u7701\u4efd\u5206\u7ec4\u7edf\u8ba1\n file2=\u57ce\u5e02\u5206\u7ec4\u7edf\u8ba1\n\n [CSVHead]\n head1=\u7701\u4efd,\u7d2f\u8ba1\n head2=\u7701\u4efd,\u57ce\u5e02,\u7d2f\u8ba1\n\n [HQLScript]\n script1=select cn_state,count(1) m from ext_act_ja1\n script2=select cn_state,cn_city,count(1) m from ext_act_ja2\n\n [EmailInfo]\n to=elkan1788@gmail.com;\n cc=2292706174@qq.com;\n # %s it will replace as the start date.\n subject=%s\u533a\u57df\u62bd\u5956\u7edf\u8ba1[\u6d4b\u8bd5]\n body=\u6b64\u90ae\u4ef6\u7531\u7cfb\u7edf\u81ea\u52a8\u53d1\u9001\uff0c\u8bf7\u52ff\u56de\u590d\uff0c\u8c22\u8c22\uff01\n\n> Remember that the file's struct doesn't change. You can save it anywhere you like. And append it as parameter to `Python` bin file.\n \n3. Start Python Script\n-----------------------\n\nFind out where you install this component folder. Run script as below:\n\n.. code-block::\n\n python -u bin/email_job.py \"/etc/emailjob/test_job.ini\" \"2018-01-01 10:00:00\" \"2018-01-01 14:00:00\"\n\n\n> Parameters:\n> 1. email job configure file path\n> 2. start time (no required)\n> 3. stop time (no required)\n\n# 4. Success execute output log\n\n.. code-block::\n\n 2018-02-20 16:28:21,561 [INFO] {__main__ } - Now running \u90ae\u4ef6\u62a5\u8868\u4efb\u52a1\u6d4b\u8bd5 Email Job...\n 2018-02-20 16:28:21,561 [INFO] {__main__ } - Start time: 2018-02-22\n 2018-02-20 16:28:21,562 [INFO] {__main__ } - Stop time: 2018-02-20\n 2018-02-20 16:28:21,691 [INFO] {pyhive.hive} - USE `default`\n 2018-02-20 16:28:21,731 [INFO] {ppytools.hive_client} - Hive server connect is ready. Transport open: True\n 2018-02-20 16:28:31,957 [INFO] {ppytools.email_client} - Email SMTP server connect ready.\n 2018-02-20 16:28:31,957 [INFO] {root } - File name list:\n 2018-02-20 16:28:31,957 [INFO] {root } - file1: \u7701\u4efd\u5206\u7ec4\u7edf\u8ba1\n 2018-02-20 16:28:31,957 [INFO] {root } - file2: \u57ce\u5e02\u5206\u7ec4\u7edf\u8ba1\n 2018-02-20 16:28:31,957 [INFO] {root } - CSV file head list:\n 2018-02-20 16:28:31,957 [INFO] {root } - head1: \u7701\u4efd,\u7d2f\u8ba1\n 2018-02-20 16:28:31,957 [INFO] {root } - head2: \u7701\u4efd,\u57ce\u5e02,\u7d2f\u8ba1\n 2018-02-20 16:28:31,957 [INFO] {root } - script1: select cn_state,count(1) m from ext_act_ja2\n 2018-02-20 16:28:31,958 [INFO] {pyhive.hive} - select cn_state,count(1) m from ext_act_ja2\n 2018-02-20 16:29:04,258 [INFO] {ppytools.hive_client} - Hive client query completed. Records found: 31\n 2018-02-20 16:29:04,259 [INFO] {ppytools.lang.timer_helper} - Execute method cost 32.3012499809 seconds.\n 2018-02-20 16:29:04,261 [INFO] {ppytools.csv_helper} - Write a CSV file successful. --> /opt/csv_files/\u7701\u4efd\u5206\u7ec4\u7edf\u8ba1_20180223162904.csv\n 2018-02-20 16:29:04,262 [INFO] {ppytools.lang.timer_helper} - Execute method cost 0.00222992897034 seconds.\n 2018-02-20 16:29:04,262 [INFO] {root } - script2: select cn_state,cn_city,count(1) m from ext_act_ja2\n 2018-02-20 16:29:04,262 [INFO] {pyhive.hive} - select cn_state,cn_city,count(1) m from ext_act_ja2\n 2018-02-20 16:29:23,462 [INFO] {ppytools.hive_client} - Hive client query completed. Records found: 367\n 2018-02-20 16:29:23,463 [INFO] {ppytools.lang.timer_helper} - Execute method cost 19.2005498409 seconds.\n 2018-02-20 16:29:23,465 [INFO] {ppytools.csv_helper} - Write a CSV file successful. --> /opt/csv_files/\u57ce\u5e02\u5206\u7ec4\u7edf\u8ba1_20180223162923.csv\n 2018-02-20 16:29:23,465 [INFO] {ppytools.lang.timer_helper} - Execute method cost 0.00227284431458 seconds.\n 2018-02-20 16:29:23,669 [INFO] {ppytools.email_client} - Send email[2018-02-22\u533a\u57df\u62bd\u5956\u7edf\u8ba1[\u6d4b\u8bd5]] success. To users: elkan1788@163.com.\n 2018-02-20 16:29:23,669 [INFO] {ppytools.lang.timer_helper} - Execute method cost 0.204078912735 seconds.\n 2018-02-20 16:29:23,714 [INFO] {__main__ } - Finished \u90ae\u4ef6\u62a5\u8868\u4efb\u52a1\u6d4b\u8bd5 Email Job.\n 2018-02-20 16:29:23,715 [INFO] {ppytools.lang.timer_helper} - Execute method cost 62.1566159725 seconds.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/elkan1788/HiveEmailJob", "keywords": "", "license": "Apache License V2.0", "maintainer": "", "maintainer_email": "", "name": "hive-email-job", "package_url": "https://pypi.org/project/hive-email-job/", "platform": "", "project_url": "https://pypi.org/project/hive-email-job/", "project_urls": { "Homepage": "https://github.com/elkan1788/HiveEmailJob" }, "release_url": "https://pypi.org/project/hive-email-job/2.1.1/", "requires_dist": null, "requires_python": "", "summary": "Use Python implements get data from Hive then send attachments to user.", "version": "2.1.1" }, "last_serial": 3643420, "releases": { "2.1.1": [ { "comment_text": "", "digests": { "md5": "7888c15253501566e225ae9e42f1c081", "sha256": "c26ba58379cffbc69e8235420e7f0d9f37be6c915957acdb1939b3b3e6e1cc68" }, "downloads": -1, "filename": "hive-email-job-2.1.1.tar.gz", "has_sig": false, "md5_digest": "7888c15253501566e225ae9e42f1c081", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5122, "upload_time": "2018-03-06T09:58:33", "url": "https://files.pythonhosted.org/packages/5a/07/20f4a54c8259aa9f3b47061337e1cd8e78b96bf02c198440699406256224/hive-email-job-2.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7888c15253501566e225ae9e42f1c081", "sha256": "c26ba58379cffbc69e8235420e7f0d9f37be6c915957acdb1939b3b3e6e1cc68" }, "downloads": -1, "filename": "hive-email-job-2.1.1.tar.gz", "has_sig": false, "md5_digest": "7888c15253501566e225ae9e42f1c081", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5122, "upload_time": "2018-03-06T09:58:33", "url": "https://files.pythonhosted.org/packages/5a/07/20f4a54c8259aa9f3b47061337e1cd8e78b96bf02c198440699406256224/hive-email-job-2.1.1.tar.gz" } ] }