David
10/06/2023, 7:40 PMserve()
method as Banias above.
The hello_world trivial example from the docs works fine for me.
However, when using serve()
on a flow that reads a file and writes to BigQuery I get the following error: AttributeError: 'NoneType' object has no attribute 'serve'
prefect version: 2.13.5Nate
10/06/2023, 7:42 PMserve
on?David
10/06/2023, 7:48 PM@flow(validate_parameters=False)
def gsheet_flow(**kwargs):
logger = get_run_logger()
data = base.Data(**kwargs)
data.create_bq_client()
<http://logger.info|logger.info>(f'{data.table_name} running')
if data.file_type == 'gsheet':
data.get_gsheet(sheets_service=sheets_service)
else:
data.get_file(drive_service=drive_service)
<http://logger.info|logger.info>(f'{data.table_name} data collected')
data.clean_col_names()
if not data.does_dataset_exist():
data.create_dataset()
if not data.does_table_exist():
data.create_table_and_load_df()
else:
data.database_upsert()
<http://logger.info|logger.info>(f'{data.table_name} inserted successfully')
if __name__ == '__main__':
# testing with single file
table_name = 'client_dataset'
file_params = files[table_name]
kwargs.update({'table_name':table_name, 'file_params': file_params})
# trying to create deployment with serve
gsheet_flow(**kwargs).serve(name='gsheet_bq_deployment')
I'm wrapping a class instance and subsequent method calls in a flow decorated function since class methods can't be tasks/flowsNate
10/06/2023, 7:53 PM.serve
on the result of your flow, not your flow objectNate
10/06/2023, 7:53 PM.serve
David
10/06/2023, 7:56 PMNate
10/06/2023, 7:58 PM