From 03be1f4e93ea933e378333c51572bc0965380297 Mon Sep 17 00:00:00 2001 From: zhenrong-wang Date: Tue, 16 Jul 2024 22:27:53 +0800 Subject: [PATCH] Fixed for volcengine Windows --- hpcopr/cluster_general_funcs.c | 12 +++++++++--- hpcopr/dataman.c | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/hpcopr/cluster_general_funcs.c b/hpcopr/cluster_general_funcs.c index 49b6032..befbecb 100644 --- a/hpcopr/cluster_general_funcs.c +++ b/hpcopr/cluster_general_funcs.c @@ -4576,12 +4576,18 @@ int volce_bucket_clean(char* workdir, char* crypto_keyfile){ return -1; } snprintf(log_tmp,FILENAME_LENGTH,"%s%s%s.log",NOW_TMP_DIR,PATH_SLASH,cluster_name); - + +#ifdef _WIN32 + snprintf(rm_task_cmd,CMDLINE_LENGTH-1,"set HOMEPATH=%s && %s rm -re %s -e tos-%s.volces.com -i %s -k %s %s/ -r -f -v -fr -m",NOW_TMP_DIR,TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address); + snprintf(rm_file_cmd,CMDLINE_LENGTH-1,"set HOMEPATH=%s && %s rm -re %s -e tos-%s.volces.com -i %s -k %s %s/ -r -f -v -fr",NOW_TMP_DIR,TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address); + snprintf(ls_task_cmd,CMDLINE_LENGTH,"set HOMEPATH=%s && %s ls -re %s -e tos-%s.volces.com -i %s -k %s %s/ -s -m -d >%s 2>&1",NOW_TMP_DIR,TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address,log_tmp); + snprintf(ls_file_cmd,CMDLINE_LENGTH,"set HOMEPATH=%s && %s ls -re %s -e tos-%s.volces.com -i %s -k %s %s/ -s -d >%s 2>&1",NOW_TMP_DIR,TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address,log_tmp); +#else snprintf(rm_task_cmd,CMDLINE_LENGTH-1,"%s rm -re %s -e tos-%s.volces.com -i %s -k %s %s/ -r -f -v -fr -m",TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address); - snprintf(rm_file_cmd,CMDLINE_LENGTH-1,"%s rm -re %s -e tos-%s.volces.com -i %s -k %s %s/ -r -f -v -fr",TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address); - + snprintf(rm_file_cmd,CMDLINE_LENGTH-1,"%s rm -re %s -e tos-%s.volces.com -i %s -k %s %s/ -r -f -v -fr",TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address); snprintf(ls_task_cmd,CMDLINE_LENGTH,"%s ls -re %s -e tos-%s.volces.com -i %s -k %s %s/ -s -m -d >%s 2>&1",TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address,log_tmp); snprintf(ls_file_cmd,CMDLINE_LENGTH,"%s ls -re %s -e tos-%s.volces.com -i %s -k %s %s/ -s -d >%s 2>&1",TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address,log_tmp); +#endif i=0; do{ diff --git a/hpcopr/dataman.c b/hpcopr/dataman.c index dc68ea7..f2153f0 100644 --- a/hpcopr/dataman.c +++ b/hpcopr/dataman.c @@ -237,13 +237,25 @@ int bucket_cp(char* workdir, char* crypto_keyfile, char* hpc_user, char* source_ } else{ if(strcmp(cmd_type,"copy")==0){ +#ifdef _WIN32 + snprintf(cmdline,CMDLINE_LENGTH-1,"set HOMEPATH=%s && %s cp -re %s -e tos-%s.volces.com -i %s -k %s %s%s %s%s %s",NOW_TMP_DIR,TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address,real_source_path,bucketinfo.bucket_address,real_target_path,real_rflag); +#else snprintf(cmdline,CMDLINE_LENGTH-1,"%s cp -re %s -e tos-%s.volces.com -i %s -k %s %s%s %s%s %s",TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address,real_source_path,bucketinfo.bucket_address,real_target_path,real_rflag); +#endif } else if(strcmp(cmd_type,"put")==0){ +#ifdef _WIN32 + snprintf(cmdline,CMDLINE_LENGTH-1,"set HOMEPATH=%s && %s cp -re %s -e tos-%s.volces.com -i %s -k %s %s %s%s %s",NOW_TMP_DIR,TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,real_source_path,bucketinfo.bucket_address,real_target_path,real_rflag); +#else snprintf(cmdline,CMDLINE_LENGTH-1,"%s cp -re %s -e tos-%s.volces.com -i %s -k %s %s %s%s %s",TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,real_source_path,bucketinfo.bucket_address,real_target_path,real_rflag); +#endif } else{ +#ifdef _WIN32 + snprintf(cmdline,CMDLINE_LENGTH-1,"set HOMEPATH=%s && %s cp -re %s -e tos-%s.volces.com -i %s -k %s %s%s %s %s",NOW_TMP_DIR,TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address,real_source_path,real_target_path,real_rflag); +#else snprintf(cmdline,CMDLINE_LENGTH-1,"%s cp -re %s -e tos-%s.volces.com -i %s -k %s %s%s %s %s",TOSUTIL_EXEC,bucketinfo.region_id,bucketinfo.region_id,bucketinfo.bucket_ak,bucketinfo.bucket_sk,bucketinfo.bucket_address,real_source_path,real_target_path,real_rflag); +#endif } } if(system(cmdline)!=0){ @@ -391,14 +403,26 @@ int bucket_rm_ls(char* workdir, char* crypto_keyfile, char* hpc_user, char* remo } else{ if(strcmp(cmd_type,"delete")==0){ +#ifdef _WIN32 + snprintf(cmdline,CMDLINE_LENGTH-1,"set HOMEPATH=%s && %s rm -re %s -e tos-%s.volces.com -i %s -k %s %s%s %s %s",NOW_TMP_DIR,TOSUTIL_EXEC,binfo.region_id,binfo.region_id,binfo.bucket_ak,binfo.bucket_sk,binfo.bucket_address,real_remote_path,real_rflag,real_fflag); +#else snprintf(cmdline,CMDLINE_LENGTH-1,"%s rm -re %s -e tos-%s.volces.com -i %s -k %s %s%s %s %s",TOSUTIL_EXEC,binfo.region_id,binfo.region_id,binfo.bucket_ak,binfo.bucket_sk,binfo.bucket_address,real_remote_path,real_rflag,real_fflag); +#endif } else{ if(strlen(real_rflag)==0){ +#ifdef _WIN32 + snprintf(cmdline,CMDLINE_LENGTH-1,"set HOMEPATH=%s && %s ls -re %s -e tos-%s.volces.com -i %s -k %s %s%s -d",NOW_TMP_DIR,TOSUTIL_EXEC,binfo.region_id,binfo.region_id,binfo.bucket_ak,binfo.bucket_sk,binfo.bucket_address,real_remote_path); +#else snprintf(cmdline,CMDLINE_LENGTH-1,"%s ls -re %s -e tos-%s.volces.com -i %s -k %s %s%s -d",TOSUTIL_EXEC,binfo.region_id,binfo.region_id,binfo.bucket_ak,binfo.bucket_sk,binfo.bucket_address,real_remote_path); +#endif } else{ +#ifdef _WIN32 + snprintf(cmdline,CMDLINE_LENGTH-1,"set HOMEPATH=%s && %s ls -re %s -e tos-%s.volces.com -i %s -k %s %s%s",NOW_TMP_DIR,TOSUTIL_EXEC,binfo.region_id,binfo.region_id,binfo.bucket_ak,binfo.bucket_sk,binfo.bucket_address,real_remote_path); +#else snprintf(cmdline,CMDLINE_LENGTH-1,"%s ls -re %s -e tos-%s.volces.com -i %s -k %s %s%s",TOSUTIL_EXEC,binfo.region_id,binfo.region_id,binfo.bucket_ak,binfo.bucket_sk,binfo.bucket_address,real_remote_path); +#endif } } }