@@ -67,7 +67,7 @@ def upload_file_to_container(container_name,
6767def __app_submit_cmd (
6868 name : str ,
6969 app : str ,
70- app_args : str ,
70+ app_args : List [ str ] ,
7171 main_class : str ,
7272 jars : List [str ],
7373 py_files : List [str ],
@@ -77,8 +77,8 @@ def __app_submit_cmd(
7777 driver_class_path : str ,
7878 driver_memory : str ,
7979 executor_memory : str ,
80- driver_cores : str ,
81- executor_cores : str ):
80+ driver_cores : int ,
81+ executor_cores : int ):
8282 cluster_id = os .environ ['AZ_BATCH_POOL_ID' ]
8383 spark_home = os .environ ['SPARK_HOME' ]
8484 with open (os .path .join (spark_home , 'conf' , 'master' )) as f :
@@ -105,8 +105,8 @@ def __app_submit_cmd(
105105 spark_submit_cmd .add_option ('--driver-class-path' , driver_class_path )
106106 spark_submit_cmd .add_option ('--driver-memory' , driver_memory )
107107 spark_submit_cmd .add_option ('--executor-memory' , executor_memory )
108- spark_submit_cmd .add_option ('--driver-cores' , driver_cores )
109- spark_submit_cmd .add_option ('--executor-cores' , executor_cores )
108+ spark_submit_cmd .add_option ('--driver-cores' , str ( driver_cores ) )
109+ spark_submit_cmd .add_option ('--executor-cores' , str ( executor_cores ) )
110110
111111 spark_submit_cmd .add_argument (
112112 os .environ ['AZ_BATCH_TASK_WORKING_DIR' ] + '/' + app + ' ' +
@@ -171,8 +171,9 @@ def upload_error_log(error, application_file_path):
171171 application = load_application (application_file_path )
172172 blob_client = config .blob_client
173173
174- error_log = open (os .path .join (os .environ ["AZ_BATCH_TASK_WORKING_DIR" ], "error.log" ), "w" )
175- error_log .write (error )
174+ with open (os .path .join (os .environ ["AZ_BATCH_TASK_WORKING_DIR" ], "error.log" ), "w" ) as error_log :
175+ error_log .write (error )
176+
176177 upload_file_to_container (
177178 container_name = os .environ ['STORAGE_LOGS_CONTAINER' ],
178179 application_name = application ['name' ],
0 commit comments