@@ -48,6 +48,8 @@ import { ProposedExtensionAPI } from './proposedApiTypes';
4848import { buildProposedApi } from './proposedApi' ;
4949import ContextManager from './pythonEnvironments/base/locators/composite/envsCollectionService' ;
5050import { PySparkParam } from './browser/extension' ;
51+ import * as fs from 'fs' ;
52+ import * as path from 'path' ;
5153
5254durations . codeLoadingTime = stopWatch . elapsedTime ;
5355
@@ -60,6 +62,17 @@ let activatedServiceContainer: IServiceContainer | undefined;
6062/////////////////////////////
6163// public functions
6264
65+ // Function to write PySparkParam to a file
66+ function writePySparkParamToFile ( params : PySparkParam , filePath : string ) : void {
67+ // Convert the object to a string in the required format
68+ const content = Object . entries ( params )
69+ . map ( ( [ key , value ] ) => `${ key } = ${ value } ` )
70+ . join ( ',\n' ) ;
71+
72+ // Write the content to the specified file
73+ fs . writeFileSync ( filePath , content ) ;
74+ }
75+
6376export async function activate ( context : IExtensionContext ) : Promise < PythonExtension > {
6477 let api : PythonExtension ;
6578 let ready : Promise < void > ;
@@ -75,12 +88,12 @@ export async function activate(context: IExtensionContext): Promise<PythonExtens
7588 } ) ,
7689 ) ;
7790
78- let gatewayUri = " http://10.245.23.158:8080" ;
91+ let gatewayUri = ' http://easdsp-gateway-bdpenv3-test.msxf.msxfyun.test' ;
7992 const runEnv = process . env . RUN_ENV ;
8093
8194 if ( runEnv === 'online' ) {
8295 console . log ( '当前运行环境: online' ) ;
83- gatewayUri = " http://easdsp-gateway.msxf.lo" ;
96+ gatewayUri = ' http://easdsp-gateway.msxf.lo' ;
8497 } else {
8598 console . log ( '当前运行环境: 非 online' ) ;
8699 }
@@ -90,6 +103,11 @@ export async function activate(context: IExtensionContext): Promise<PythonExtens
90103 commands . registerCommand ( 'pyspark.paramRegister.copy' , ( pySparkParam : PySparkParam ) => {
91104 console . log ( `PySparkParam-python: ${ JSON . stringify ( pySparkParam ) } ` ) ;
92105 context . globalState . update ( 'pyspark.paramRegister.copy' , pySparkParam ) ;
106+ // 将项目信息写到本地
107+ const filePath = path . join ( '/tmp' , 'pySparkParam.txt' ) ;
108+ // Write the pySparkParam to the file
109+ writePySparkParamToFile ( pySparkParam , filePath ) ;
110+ console . log ( `pySparkParam has been written to ${ filePath } ` ) ;
93111 } ) ,
94112 ) ;
95113
0 commit comments