@@ -20,22 +20,13 @@ const path = require('path');
2020const assert = require ( 'node:assert/strict' ) ;
2121const { describe, it} = require ( 'mocha' ) ;
2222const cp = require ( 'child_process' ) ;
23+ const { BatchServiceClient} = require ( '@google-cloud/batch' ) . v1 ;
24+ const { deleteJob} = require ( './batchClient_operations' ) ;
25+
2326const execSync = cmd => cp . execSync ( cmd , { encoding : 'utf-8' } ) ;
2427const cwd = path . join ( __dirname , '..' ) ;
25- const { BatchServiceClient} = require ( '@google-cloud/batch' ) . v1 ;
2628const batchClient = new BatchServiceClient ( ) ;
2729
28- async function deleteJob ( projectId , region , jobId ) {
29- const request = {
30- name : `projects/${ projectId } /locations/${ region } /jobs/${ jobId } ` ,
31- } ;
32- try {
33- await batchClient . deleteJob ( request ) ;
34- } catch ( err ) {
35- console . error ( 'Error deleting job:' , err ) ;
36- }
37- }
38-
3930describe ( 'Create batch GPU job' , async ( ) => {
4031 const jobName = 'batch-gpu-job' ;
4132 const region = 'europe-central2' ;
@@ -46,7 +37,7 @@ describe('Create batch GPU job', async () => {
4637 } ) ;
4738
4839 after ( async ( ) => {
49- await deleteJob ( projectId , region , jobName ) ;
40+ await deleteJob ( batchClient , projectId , region , jobName ) ;
5041 } ) ;
5142
5243 it ( 'should create a new job with GPU' , async ( ) => {
0 commit comments