Esempio n. 1
0
def test_spark_existing():
	sc = SparkContext()
	station.start(sc)
	assert station.mode() == 'spark'
	assert isinstance(station.engine(), SparkContext)
	assert station.engine().parallelize([1,2,3]).count() == 3
	station.stop()
Esempio n. 2
0
def test_spark_opts():
	station.start(spark=True, opts={'master': 'local', 'appName': 'hello'})
	assert station.mode() == 'spark'
	assert isinstance(station.engine(), SparkContext)
	assert station.engine().master == 'local'
	assert station.engine().appName == 'hello'
	assert station.engine().parallelize([1,2,3]).count() == 3
	station.stop()
Esempio n. 3
0
import station
import requests


response = requests.get('https://api.hh.ru/metro/2')
todos = json.loads(response.text)
print()
colors={'D6083B':'red','0078C9':'blue','009A49':'green','EA7125':'orange','702785':'purple'}

all_stations_all_lines=[]

for i in todos['lines']:
    all_stations_one_line=[]

    for j in i['stations']:
        one_station=station.stop()
        one_station.set_name(j['name'])
        one_station.set_color(colors.get(i['hex_color']))
        one_station.set_lat(j['lat'])
        one_station.set_lng(j['lng'])
        all_stations_one_line.append(one_station)
        print()
    all_stations_all_lines.append(all_stations_one_line)
    all_stations_one_line=[]
print()

map = folium.Map(location=[59.9386,30.3141], zoom_start = 12)

for i in all_stations_all_lines:
    for j in i:
        print()
Esempio n. 4
0
def test_spark_close():
	station.start(spark=True)
	assert station.mode() == 'spark'
	station.stop()
	assert station.mode() == 'local'
Esempio n. 5
0
def test_spark():
	station.start(spark=True)
	assert station.mode() == 'spark'
	assert isinstance(station.engine(), SparkContext)
	assert station.engine().parallelize([1,2,3]).count() == 3
	station.stop()