예제 #1
0
def gerenciador(cont):    
    
    numberofChange = [kk for kk in params['conta'].keys()]

    if str(cont) in numberofChange:
        
        gee.switch_user(params['conta'][str(cont)])
        gee.init()        
        gee.tasks(n= params['numeroTask'], return_list= True)        
    
    elif cont > params['numeroLimit']:
        cont = 0
    
    cont += 1    
    return cont
예제 #2
0
def gerenciador(cont, param):
    #0, 18, 36, 54]
    #=====================================#
    # gerenciador de contas para controlar#
    # processos task no gee               #
    #=====================================#
    numberofChange = [kk for kk in param['conta'].keys()]

    if str(cont) in numberofChange:

        gee.switch_user(param['conta'][str(cont)])
        gee.init()
        gee.tasks(n=param['numeroTask'], return_list=True)

    elif cont > param['numeroLimit']:
        cont = 0

    cont += 1
    return cont
    # 'mapbiomas-ingestion-2',
    # 'mapbiomas-ingestion-3',
    # 'mapbiomas-ingestion-4',
    # 'mapbiomas-ingestion-5',
]


def Ingest(manifest):

    try:
        task = ee.data.startIngestion(ee.data.newTaskId()[0], manifest)
    except Exception as e:
        print 'error!', e


if __name__ == '__main__':

    ee.Initialize(credentials='persistent', use_cloud_api=True)

    account = random.choice(ACCOUNTS)
    gee_toolbox.switch_user(account)

    manifestFile = "./4157_20190601_140036_1006.json"

    with open(manifestFile) as manifestData:
        manifest = json.load(manifestData)
        pprint(manifest)
        Ingest(manifest)

    ee.Reset()