-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·31 lines (25 loc) · 994 Bytes
/
main.py
File metadata and controls
executable file
·31 lines (25 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
from cluster_util.spark_util import SparkUtil
from cluster_util.hive_util import HiveUtil
from bus_controller.master_controller import MasterController
from Logger import logger
__MODULEID__ = "{9690551b-43d2-41d1-96ed-131e9b1aedef}"
__VERSION__ = '1.0.0'
__AUTHOR__ = 'menluyao'
# __all__ = ['method']
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
# Initailize spark session
logger.info('Connecting spark session ...')
spark = SparkUtil().build_spark_session(app_name="Shared Bike Analysis System") # is_standalone=True, host="master", port=7077
hive = HiveUtil(spark)
# hive = HiveUtil().build_hive_context(spark)
# if spark is None or hive is None:
# logger.error('Cluster connection fail.')
# exit(0)
# Initailize trip
master = MasterController(spark, hive=hive, is_test=False)
master.init_dw()
master.trip_handler(re_mid=True)
master.statistics()
master.ctor()