(ctx, **kwargs)
\b
    - DESCRIPTION:
        Upload Data Table.

    \b
    - Usage:
        flow data upload -c fate_flow/examples/upload_guest.json
        flow data upload -c fate_flow/examples/upload_host.json --verbose --drop
\b
    - DESCRIPTION:
        Upload Data Table.
\ b - DESCRIPTION : Upload Data Table .
def upload(ctx, **kwargs):
    """
    \b
    - DESCRIPTION:
        Upload Data Table.

    \b
    - Usage:
        flow data upload -c fate_flow/examples/upload_guest.json
        flow data upload -c fate_flow/examples/upload_host.json --verbose --drop
    """
    kwargs['drop'] = 1 if kwargs['drop'] else 0
    kwargs['verbose'] = int(kwargs['verbose'])
    config_data, dsl_data = preprocess(**kwargs)
    if config_data.get('use_local_data', 1):
        file_name = check_abs_path(config_data.get('file'))
        if os.path.exists(file_name):
            with open(file_name, 'rb') as fp:
                data = MultipartEncoder(
                    fields={'file': (os.path.basename(file_name), fp, 'application/octet-stream')}
                )
                tag = [0]

                def read_callback(monitor):
                    if config_data.get('verbose') == 1:
                        sys.stdout.write("\r UPLOADING:{0}{1}".format("|" * (monitor.bytes_read * 100 // monitor.len), '%.2f%%' % (monitor.bytes_read * 100 // monitor.len)))
                        sys.stdout.flush()
                        if monitor.bytes_read / monitor.len == 1:
                            tag[0] += 1
                            if tag[0] == 2:
                                sys.stdout.write('\n')

                data = MultipartEncoderMonitor(data, read_callback)
                access_server('post', ctx, 'data/upload', json_data=None, data=data,
                              params=json.dumps(config_data), headers={'Content-Type': data.content_type})
        else:
            prettify(
                {
                    "retcode": 100,
                    "retmsg": "The file is obtained from the fate flow client machine, but it does not exist, "
                              "please check the path: {}".format(file_name)
                }
            )
    else:
        access_server('post', ctx, 'data/upload', config_data)
def upload ( ctx , * * kwargs ) : kwargs [ 'drop' ] = 1 if kwargs [ 'drop' ] else 0 kwargs [ 'verbose' ] = int ( kwargs [ 'verbose' ] ) config_data , dsl_data = preprocess ( * * kwargs ) if config_data . get ( 'use_local_data' , 1 ) : file_name = check_abs_path ( config_data . get ( 'file' ) ) if os . path . exists ( file_name ) : with open ( file_name , 'rb' ) as fp : data = MultipartEncoder ( fields = { 'file' : ( os . path . basename ( file_name ) , fp , 'application/octet-stream' ) } ) tag = [ 0 ] def read_callback ( monitor ) : if config_data . get ( 'verbose' ) == 1 : sys . stdout . write ( "\r UPLOADING:{0}{1}" . format ( "|" * ( monitor . bytes_read * 100 // monitor . len ) , '%.2f%%' % ( monitor . bytes_read * 100 // monitor . len ) ) ) sys . stdout . flush ( ) if monitor . bytes_read / monitor . len == 1 : tag [ 0 ] += 1 if tag [ 0 ] == 2 : sys . stdout . write ( '\n' ) data = MultipartEncoderMonitor ( data , read_callback ) access_server ( 'post' , ctx , 'data/upload' , json_data = None , data = data , params = json . dumps ( config_data ) , headers = { 'Content-Type' : data . content_type } ) else : prettify ( { "retcode" : 100 , "retmsg" : "The file is obtained from the fate flow client machine, but it does not exist, " "please check the path: {}" . format ( file_name ) } ) else : access_server ( 'post' , ctx , 'data/upload' , config_data )