@@ -48,6 +48,8 @@ import { ProposedExtensionAPI } from './proposedApiTypes';
48
48
import { buildProposedApi } from './proposedApi' ;
49
49
import ContextManager from './pythonEnvironments/base/locators/composite/envsCollectionService' ;
50
50
import { PySparkParam } from './browser/extension' ;
51
+ import * as fs from 'fs' ;
52
+ import * as path from 'path' ;
51
53
52
54
durations . codeLoadingTime = stopWatch . elapsedTime ;
53
55
@@ -60,6 +62,17 @@ let activatedServiceContainer: IServiceContainer | undefined;
60
62
/////////////////////////////
61
63
// public functions
62
64
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
+
63
76
export async function activate ( context : IExtensionContext ) : Promise < PythonExtension > {
64
77
let api : PythonExtension ;
65
78
let ready : Promise < void > ;
@@ -75,12 +88,12 @@ export async function activate(context: IExtensionContext): Promise<PythonExtens
75
88
} ) ,
76
89
) ;
77
90
78
- let gatewayUri = " http://10.245.23.158:8080" ;
91
+ let gatewayUri = ' http://easdsp-gateway-bdpenv3-test.msxf.msxfyun.test' ;
79
92
const runEnv = process . env . RUN_ENV ;
80
93
81
94
if ( runEnv === 'online' ) {
82
95
console . log ( '当前运行环境: online' ) ;
83
- gatewayUri = " http://easdsp-gateway.msxf.lo" ;
96
+ gatewayUri = ' http://easdsp-gateway.msxf.lo' ;
84
97
} else {
85
98
console . log ( '当前运行环境: 非 online' ) ;
86
99
}
@@ -90,6 +103,11 @@ export async function activate(context: IExtensionContext): Promise<PythonExtens
90
103
commands . registerCommand ( 'pyspark.paramRegister.copy' , ( pySparkParam : PySparkParam ) => {
91
104
console . log ( `PySparkParam-python: ${ JSON . stringify ( pySparkParam ) } ` ) ;
92
105
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 } ` ) ;
93
111
} ) ,
94
112
) ;
95
113
0 commit comments