Default service configuration in directory or file (#38).
This commit is contained in:
9
bonobo/examples/datasets/_services.py
Normal file
9
bonobo/examples/datasets/_services.py
Normal file
@ -0,0 +1,9 @@
|
||||
from os.path import dirname
|
||||
|
||||
import bonobo
|
||||
|
||||
|
||||
def get_services():
|
||||
return {
|
||||
'fs': bonobo.open_fs(dirname(__file__))
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
import bonobo
|
||||
from bonobo.commands.run import get_default_services
|
||||
from bonobo.ext.opendatasoft import OpenDataSoftAPI
|
||||
|
||||
filename = 'coffeeshops.txt'
|
||||
@ -9,13 +10,5 @@ graph = bonobo.Graph(
|
||||
bonobo.FileWriter(path=filename),
|
||||
)
|
||||
|
||||
|
||||
def get_services():
|
||||
from os.path import dirname
|
||||
return {
|
||||
'fs': bonobo.open_fs(dirname(__file__))
|
||||
}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
bonobo.run(graph, services=get_services())
|
||||
bonobo.run(graph, services=get_default_services(__file__))
|
||||
|
||||
@ -3,6 +3,7 @@ import json
|
||||
from colorama import Fore, Style
|
||||
|
||||
import bonobo
|
||||
from bonobo.commands.run import get_default_services
|
||||
from bonobo.ext.opendatasoft import OpenDataSoftAPI
|
||||
|
||||
try:
|
||||
@ -57,16 +58,8 @@ graph = bonobo.Graph(
|
||||
normalize,
|
||||
filter_france,
|
||||
bonobo.Tee(display),
|
||||
bonobo.JsonWriter(path='datasets/fablabs.txt'),
|
||||
bonobo.JsonWriter(path='fablabs.txt'),
|
||||
)
|
||||
|
||||
|
||||
def get_services():
|
||||
from os.path import dirname
|
||||
return {
|
||||
'fs': bonobo.open_fs(dirname(__file__))
|
||||
}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
bonobo.run(graph, services=get_services())
|
||||
bonobo.run(graph, services=get_default_services(__file__))
|
||||
|
||||
Reference in New Issue
Block a user