create a simple HDFS client for example:
import logging
import subprocess
from typing import List, Tuple, Union, TextIO, BinaryIO
{"config":{"codeTheme":"OneDarkPro","pageThemeSyncCodeTheme":true,"openAlmightyConsole":true,"autoRun":true,"layout":"edit","keepPreviousLogs":true,"codeFontSize":14},"title":"coderun-echarts","code":{"HTML":{"language":"html","content":"<!-- 为ECharts准备一个具备大小(宽高)的Dom -->\n<div id=\"main\" style=\"width: 800px; height:600px;\"></div>","resources":[]},"CSS":{"language":"css","content":"","resources":[]},"JS":{"language":"javascript","content":"// 基于准备好的dom,初始化echarts实例\nvar myChart = echarts.init(document.getElementById(\"main\"));\n\n// 指定图表的配置项和数据\n// prettier-ignore\nconst hours = [\n '0','1星','2星','3星','4星','5星','6'\n];\n\n// prettier-ignore\nconst days = [\n '智驾车型覆盖度',\t'自动泊车',\t'记忆泊车',\t'高速LCC',\t'城区LCC',\t'高速领航辅助驾驶',\t'城区领航辅助驾驶'\n];\n\n// prettier-ignore\nconst data = [[0, 3, 1], [0, 4, 4], [0, 5, 1], [1, 4, 6], [2, 3, 1], [2, 5, 3], [3, 5, 6], [4, 4, 3], [4, 5, 3], [5, 3, 1], [5, 4, 2], [5, 5, 3], [6, 3, 1], [6, 4, 2], [6, 5, 2]];\nconst title = [];\nconst singleAxis = [];\nconst series = [];\ncon |
from concurrent.futures import as_completed | |
from concurrent.futures.process import ProcessPoolExecutor | |
import os | |
import psutil | |
import time | |
def kill_child_processes(parent_pid): | |
try: | |
parent = psutil.Process(parent_pid) |
package com.example.udf; | |
import com.google.common.base.Throwables; | |
import org.apache.hadoop.hive.ql.exec.Description; | |
import org.apache.hadoop.hive.ql.exec.UDFArgumentException; | |
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException; | |
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException; | |
import org.apache.hadoop.hive.ql.metadata.HiveException; | |
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; | |
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; |
# this function will be called on exceptions in any cell
def when_exception(shell, etype, evalue, tb, tb_offset=None):
# still show the error within the notebook, don't just swallow it
shell.showtraceback((etype, evalue, tb), tb_offset=tb_offset)
err_msg = f'Unexpected exception occured: {repr(evalue)}'
logger.error(err_msg)
A wrapper for Python protobuf object:
class PbMessage(object):
"""protobuf 消息的包装类,封装一些通用方法"""
def __init__(self, pb_class):
self._pb_class = pb_class
self._pb_obj = None
self._raw_msg = None
Python Stream object act like Java Stream, features include lazy calculating, slicing, chain-call etc.
stream.py
:
import functools
import itertools
class Stream(object):