{"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-539:input_1","from_node_id":"-185:data"},{"to_node_id":"-32:input_ds","from_node_id":"-185:data"}],"nodes":[{"node_id":"-539","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# 修改数据列名\ndef bigquant_run(input_ds, columns, keep_old_columns):\n # 解析列映射为dict, TODO: 验证输入是否有效\n columns = dict(c.split(':') for c in columns.split('|'))\n print('列名映射:', columns)\n # 输出数据源\n df = input_ds.read()\n old_column_set = set(df.columns)\n for old_col, new_col in columns.items():\n if old_col not in old_column_set:\n print('警告:列 %s 不存在' % old_col)\n if keep_old_columns:\n for old_col, new_col in columns.items():\n if old_col in old_column_set:\n df[new_col] = df[old_col]\n else:\n df.columns = [columns.get(c, c) for c in df.columns]\n\n return Outputs(data=DataSource.write_df(df))\n","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"input_ds","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{\n 'columns': 'deal_number:new_deal_number|close:new_close',\n 'keep_old_columns': True\n}\n","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"data","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-539"},{"name":"input_2","node_id":"-539"},{"name":"input_3","node_id":"-539"}],"output_ports":[{"name":"data_1","node_id":"-539"},{"name":"data_2","node_id":"-539"},{"name":"data_3","node_id":"-539"}],"cacheable":true,"seq_num":19,"comment":"","comment_collapsed":true},{"node_id":"-185","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"2018-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2018-02-01","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-185"},{"name":"features","node_id":"-185"}],"output_ports":[{"name":"data","node_id":"-185"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-32","module_id":"BigQuantSpace.columns_rename.columns_rename-v1","parameters":[{"name":"columns","value":"deal_number:new_deal_number|close:new_close","type":"Literal","bound_global_parameter":null},{"name":"keep_old_columns","value":"True","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-32"}],"output_ports":[{"name":"data","node_id":"-32"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-539' Position='1037,79,200,200'/><node_position Node='-185' Position='761,-15,200,200'/><node_position Node='-32' Position='742.6492309570312,111.48371887207031,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
[2021-12-16 17:32:24.205522] INFO: moduleinvoker: use_datasource.v1 开始运行..
[2021-12-16 17:32:24.797068] INFO: moduleinvoker: 命中缓存
[2021-12-16 17:32:24.826510] INFO: moduleinvoker: use_datasource.v1 运行完成[0.618081s].
[2021-12-16 17:32:26.231656] INFO: moduleinvoker: columns_rename.v1 开始运行..
[2021-12-16 17:32:31.418480] INFO: moduleinvoker: columns_rename.v1 运行完成[5.186837s].
列名映射: {'deal_number': 'new_deal_number', 'close': 'new_close'}