(ctx, **kwargs)
\b
    - DESCRIPTION:
        Download Configurations of A Specified Job.

    \b
    - USAGE:
        flow job config -j $JOB_ID -r host -p 10000 --output-path ./examples/
\b
    - DESCRIPTION:
        Download Configurations of A Specified Job.
\ b - DESCRIPTION : Download Configurations of A Specified Job .
def config(ctx, **kwargs):
    """
    \b
    - DESCRIPTION:
        Download Configurations of A Specified Job.

    \b
    - USAGE:
        flow job config -j $JOB_ID -r host -p 10000 --output-path ./examples/
    """
    config_data, dsl_data = preprocess(**kwargs)
    response = access_server('post', ctx, 'job/config', config_data, False)
    if isinstance(response, requests.models.Response):
        response = response.json()
    if isinstance(response, flask.wrappers.Response):
        response = response.json
    if response['retcode'] == 0:
        job_id = response['data']['job_id']
        download_directory = os.path.join(os.path.abspath(config_data['output_path']), 'job_{}_config'.format(job_id))
        os.makedirs(download_directory, exist_ok=True)
        for k, v in response['data'].items():
            if k == 'job_id':
                continue
            with open('{}/{}.json'.format(download_directory, k), 'w') as fw:
                json.dump(v, fw, indent=4)
        del response['data']['dsl']
        del response['data']['runtime_conf']
        response['directory'] = download_directory
        response['retmsg'] = 'download successfully, please check {} directory'.format(download_directory)
    prettify(response)
def config ( ctx , * * kwargs ) : config_data , dsl_data = preprocess ( * * kwargs ) response = access_server ( 'post' , ctx , 'job/config' , config_data , False ) if isinstance ( response , requests . models . Response ) : response = response . json ( ) if isinstance ( response , flask . wrappers . Response ) : response = response . json if response [ 'retcode' ] == 0 : job_id = response [ 'data' ] [ 'job_id' ] download_directory = os . path . join ( os . path . abspath ( config_data [ 'output_path' ] ) , 'job_{}_config' . format ( job_id ) ) os . makedirs ( download_directory , exist_ok = True ) for k , v in response [ 'data' ] . items ( ) : if k == 'job_id' : continue with open ( '{}/{}.json' . format ( download_directory , k ) , 'w' ) as fw : json . dump ( v , fw , indent = 4 ) del response [ 'data' ] [ 'dsl' ] del response [ 'data' ] [ 'runtime_conf' ] response [ 'directory' ] = download_directory response [ 'retmsg' ] = 'download successfully, please check {} directory' . format ( download_directory ) prettify ( response )