Changeset 619 for trunk/libIGCM/libIGCM_sys
- Timestamp:
- 03/30/12 15:11:37 (12 years ago)
- Location:
- trunk/libIGCM/libIGCM_sys
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_ulam.ksh
r506 r619 1 #!/bin/ksh 1 #!/bin/ksh 2 2 3 3 #************************************************************** … … 14 14 #========================================================= 15 15 # The documentation of this file can be automatically generated 16 # if you use the prefix #D- for comments to be extracted. 16 # if you use the prefix #D- for comments to be extracted. 17 17 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 18 18 #========================================================= … … 22 22 #D-#================================================== 23 23 #D- 24 #D- This ksh library if a layer under some usefull 24 #D- This ksh library if a layer under some usefull 25 25 #D-environment variables and shell commands. 26 26 #D-All those definitions depend on host particularities. … … 62 62 63 63 #===================================================== 64 # Host and user names 64 # Host and user names 65 65 # $hostname ou hostname 66 66 typeset HOST=${HOST:=$( hostname )} … … 101 101 #==================================================== 102 102 #- ARCHIVE 103 # modified 17/10/2011 /u to be used for file stored on gaya 104 if (tty -s ) then 105 typeset -r ARCHIVE=${HOMEGAYA}106 else 107 typeset -r ARCHIVE=$(echo ${HOMEGAYA}|sed 's,/homegaya/,/u/',)103 # modified 17/10/2011 /u to be used for file stored on gaya 104 if (tty -s ) then 105 typeset -r ARCHIVE=${HOMEGAYA} 106 else 107 typeset -r ARCHIVE=$(echo ${HOMEGAYA}|sed 's,/homegaya/,/u/',) 108 108 fi 109 109 … … 118 118 119 119 #==================================================== 120 #- R_BUF Buffer to pack files stored on Master 121 typeset -r R_BUF=${WORKDIR}/IGCM_OUT 122 123 #==================================================== 120 124 #- OUT_POST 121 125 typeset -r R_OUT_POST=${WORKDIR}/IGCM_OUT … … 136 140 function IGCM_sys_RshMaster { 137 141 #set -vx 138 139 142 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 143 rsh ${MASTER} exec /bin/ksh <<-EOF 140 144 export libIGCM=${libIGCM_SX} 141 145 export DEBUG_debug=${DEBUG_debug} … … 144 148 ${@} 145 149 EOF 146 147 148 149 150 150 if [ $? -gt 0 ] ; then 151 echo "IGCM_sys_RshMaster : erreur." 152 IGCM_debug_Exit "IGCM_sys_RshMaster" 153 fi 154 IGCM_debug_PopStack "IGCM_sys_RshMaster" 151 155 } 152 156 … … 157 161 #D- 158 162 function IGCM_sys_RshArchive { 159 160 163 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 164 /bin/ksh <<-EOF 161 165 ${@} 162 166 EOF 163 164 165 166 167 167 if [ $? -gt 0 ] ; then 168 echo "IGCM_sys_RshArchive : erreur." 169 IGCM_debug_Exit "IGCM_sys_RshArchive" 170 fi 171 IGCM_debug_PopStack "IGCM_sys_RshArchive" 168 172 } 169 173 … … 174 178 #D- 175 179 function IGCM_sys_RshPost { 176 177 178 179 180 181 182 183 184 185 180 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 181 if ( $DEBUG_sys ) ; then 182 echo "IGCM_sys_RshPost :" $@ 183 fi 184 /bin/ksh ${@} 185 if [ $? -gt 0 ] ; then 186 echo "IGCM_sys_RshPost : erreur." 187 IGCM_debug_Exit "IGCM_sys_RshPost" 188 fi 189 IGCM_debug_PopStack "IGCM_sys_RshPost" 186 190 } 187 191 … … 192 196 #D- 193 197 function IGCM_sys_SendMail { 194 195 196 197 198 199 200 201 202 203 204 198 IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@ 199 if ( $DEBUG_sys ) ; then 200 echo "IGCM_sys_SendMail :" $@ 201 fi 202 203 if ( ${ExitFlag} ) ; then 204 status=failed 205 else 206 status=completed 207 fi 208 cat << END_MAIL > job_end.mail 205 209 Dear ${LOGIN}, 206 210 … … 212 216 END_MAIL 213 217 214 215 216 217 218 219 220 221 222 223 224 218 if [ ! -z ${config_UserChoices_MailName} ] ; then 219 mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 220 elif [ -f ~/.forward ] ; then 221 mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 222 fi 223 224 if [ $? -gt 0 ] ; then 225 echo "IGCM_sys_SendMail : erreur." 226 IGCM_debug_Exit "IGCM_sys_SendMail" 227 fi 228 IGCM_debug_PopStack "IGCM_sys_SendMail" 225 229 } 226 230 … … 231 235 #D- 232 236 function IGCM_sys_Mkdir { 233 234 235 236 237 238 239 240 241 242 243 237 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 238 if ( $DEBUG_sys ) ; then 239 echo "IGCM_sys_Mkdir :" $@ 240 fi 241 if [ ! -d ${1} ]; then 242 \mkdir -p $1 243 if [ $? -gt 0 ] ; then 244 echo "IGCM_sys_Mkdir : erreur." 245 IGCM_debug_Exit "IGCM_sys_Mkdir" 246 fi 247 fi 244 248 # vérification : 245 246 247 248 249 249 if [ ! -d ${1} ] ; then 250 echo "IGCM_sys_Mkdir : erreur." 251 IGCM_debug_Exit "IGCM_sys_Mkdir" 252 fi 253 IGCM_debug_PopStack "IGCM_sys_Mkdir" 250 254 } 251 255 … … 256 260 #D- 257 261 function IGCM_sys_MkdirArchive { 258 259 260 261 262 IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 263 if ( $DEBUG_sys ) ; then 264 echo "IGCM_sys_MkdirArchive :" $@ 265 fi 262 266 #- creation de repertoire sur le serveur fichier 263 if [ ! -d ${1} ]; then264 265 266 267 268 269 270 267 if [ ! -d ${1} ]; then 268 \mkdir -p $1 269 if [ $? -gt 0 ] ; then 270 echo "IGCM_sys_MkdirArchive : erreur." 271 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 272 fi 273 fi 274 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 271 275 } 272 276 … … 277 281 #D- 278 282 function IGCM_sys_MkdirWork { 279 280 281 282 283 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 284 if ( $DEBUG_sys ) ; then 285 echo "IGCM_sys_MkdirWork :" $@ 286 fi 283 287 #- creation de repertoire sur le serveur fichier 284 if [ ! -d ${1} ]; then285 286 287 288 289 290 291 288 if [ ! -d ${1} ]; then 289 \mkdir -p $1 290 if [ $? -gt 0 ] ; then 291 echo "IGCM_sys_MkdirWork : erreur." 292 IGCM_debug_Exit "IGCM_sys_MkdirWork" 293 fi 294 fi 295 IGCM_debug_PopStack "IGCM_sys_MkdirWork" 292 296 } 293 297 … … 298 302 #D- 299 303 function IGCM_sys_Cd { 300 301 302 303 304 305 306 307 308 309 304 IGCM_debug_PushStack "IGCM_sys_Cd" $@ 305 if ( $DEBUG_sys ) ; then 306 echo "IGCM_sys_Cd :" $@ 307 fi 308 \cd $1 309 if [ $? -gt 0 ] ; then 310 echo "IGCM_sys_Cd : erreur." 311 IGCM_debug_Exit "IGCM_sys_Cd" 312 fi 313 IGCM_debug_PopStack "IGCM_sys_Cd" 310 314 } 311 315 … … 316 320 #D- 317 321 function IGCM_sys_Chmod { 318 319 320 321 322 323 324 325 326 327 328 329 330 331 322 IGCM_debug_PushStack "IGCM_sys_Chmod" $@ 323 if ( $DEBUG_sys ) ; then 324 echo "IGCM_sys_Chmod :" $@ 325 fi 326 if [ $DRYRUN -le 1 ]; then 327 \chmod $@ 328 if [ $? -gt 0 ] ; then 329 echo "IGCM_sys_Chmod : erreur." 330 IGCM_debug_Exit "IGCM_sys_Chmod" 331 fi 332 else 333 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 334 fi 335 IGCM_debug_PopStack "IGCM_sys_Chmod" 332 336 } 333 337 … … 338 342 #D- 339 343 function IGCM_sys_FileSize { 340 341 342 343 344 345 346 347 348 349 344 IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 345 346 typeset sizeF 347 set +A sizeF -- $( ls -la ${1} ) 348 if [ $? -gt 0 ] ; then 349 IGCM_debug_Exit "IGCM_sys_FileSize" 350 fi 351 eval ${2}=${sizeF[4]} 352 353 IGCM_debug_PopStack "IGCM_sys_FileSize" 350 354 } 351 355 … … 356 360 #D- 357 361 function IGCM_sys_TestDir { 358 359 360 361 362 363 364 365 366 362 IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 363 if ( $DEBUG_sys ) ; then 364 echo "IGCM_sys_TestDir :" $@ 365 fi 366 typeset ExistFlag 367 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 368 IGCM_debug_PopStack "IGCM_sys_TestDir" 369 370 return ${ExistFlag} 367 371 } 368 372 … … 373 377 #D- 374 378 function IGCM_sys_TestDirArchive { 375 376 377 378 379 typeset ExistFlag DirNameToTest380 # modified 17/10/2011 /u is not known on ulam, use /homegaya instead to test dir locally on ulam 381 DirNameToTest=$(echo $1 | sed 's,/u/,/homegaya/,')382 383 384 385 379 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 380 if ( $DEBUG_sys ) ; then 381 echo "IGCM_sys_TestDirArchive :" $@ 382 fi 383 typeset ExistFlag DirNameToTest 384 # modified 17/10/2011 /u is not known on ulam, use /homegaya instead to test dir locally on ulam 385 DirNameToTest=$(echo $1 | sed 's,/u/,/homegaya/,') 386 ExistFlag=$( [ -d ${DirNameToTest} ] && echo 0 || echo 1 ) 387 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 388 389 return ${ExistFlag} 386 390 } 387 391 … … 392 396 #D- 393 397 function IGCM_sys_TestFileArchive { 394 395 396 397 398 typeset ExistFlag FileNameToTest399 # modified 17/10/2011 /u is not known on ulam, use /homegaya instead to test dir locally on ulam 400 FileNameToTest=$(echo $1 | sed 's,/u/,/homegaya/,')401 ExistFlag=$( IGCM_sys_RshArchive "[ -f ${FileNameToTest} ] && echo 0 || echo 1" )402 403 404 398 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 399 if ( $DEBUG_sys ) ; then 400 echo "IGCM_sys_TestFileArchive :" $@ 401 fi 402 typeset ExistFlag FileNameToTest 403 # modified 17/10/2011 /u is not known on ulam, use /homegaya instead to test dir locally on ulam 404 FileNameToTest=$(echo $1 | sed 's,/u/,/homegaya/,') 405 ExistFlag=$( IGCM_sys_RshArchive "[ -f ${FileNameToTest} ] && echo 0 || echo 1" ) 406 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 407 408 return ${ExistFlag} 405 409 } 406 410 … … 411 415 #D- 412 416 function IGCM_sys_CountFileArchive { 413 414 415 416 417 418 417 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 418 IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 419 if [ $? -gt 0 ] ; then 420 echo "IGCM_sys_CountFileArchive : erreur." 421 fi 422 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 419 423 } 420 424 … … 425 429 #D- 426 430 function IGCM_sys_Tree { 427 428 429 430 431 432 433 434 431 IGCM_debug_PushStack "IGCM_sys_Tree" $@ 432 if ( $DEBUG_sys ) ; then 433 echo "IGCM_sys_Tree :" $@ 434 fi 435 436 \mfls -r $@ 437 438 IGCM_debug_PopStack "IGCM_sys_Tree" 435 439 } 436 440 … … 441 445 #D- 442 446 function IGCM_sys_Tar { 443 444 445 446 447 448 449 450 451 452 453 454 447 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 448 if ( $DEBUG_sys ) ; then 449 echo "IGCM_sys_Tar :" $@ 450 fi 451 \tar cvf $@ 452 if [ $? -gt 0 ] ; then 453 echo "IGCM_sys_Tar : erreur." 454 IGCM_debug_Exit "IGCM_sys_Tar" 455 fi 456 \tar tvf $1 457 458 IGCM_debug_PopStack "IGCM_sys_Tar" 455 459 } 456 460 … … 461 465 #D- 462 466 function IGCM_sys_UnTar { 463 464 465 466 467 468 469 470 471 472 467 IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 468 if ( $DEBUG_sys ) ; then 469 echo "IGCM_sys_UnTar :" $@ 470 fi 471 \tar xvf $1 472 if [ $? -gt 0 ] ; then 473 echo "IGCM_sys_UnTar : erreur." 474 IGCM_debug_Exit "IGCM_sys_UnTar" 475 fi 476 IGCM_debug_PopStack "IGCM_sys_UnTar" 473 477 } 474 478 … … 479 483 #D- 480 484 function IGCM_sys_QsubPost { 481 482 483 484 485 486 487 488 489 490 491 492 485 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 486 if ( $DEBUG_sys ) ; then 487 echo "IGCM_sys_QsubPost :" $@ 488 fi 489 cd ${POST_DIR} 490 /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM}/$1.job 491 cd - 492 if [ $? -gt 0 ] ; then 493 echo "IGCM_sys_QsubPost : erreur " $@ 494 IGCM_debug_Exit "IGCM_sys_QsubPost" 495 fi 496 IGCM_debug_PopStack "IGCM_sys_QsubPost" 493 497 } 494 498 495 499 #D-************************* 496 #D- File transfer functions 500 #D- File transfer functions 497 501 #D-************************* 498 502 #D- … … 504 508 #D- Error values and explanations can depend on your system version. 505 509 function IGCM_sys_Rsync_out { 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 0) return;; 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 } 609 510 RET=$1 511 if [ ! $RET ] ; then 512 echo "rsync error !" 513 fi 514 515 if [ $MYLANG = "fr" ]; then 516 case $RET in 517 0) return ;; 518 1) echo "Erreur de rsync ; RERR_SYNTAX : " 519 echo "Erreur de syntaxe ou d'utilisation." 520 return;; 521 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 522 echo "Incompatibilité de protocole." 523 return;; 524 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 525 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 526 echo "répertoires" 527 return;; 528 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 529 echo "Action demandée non supportée : une tentative de manipulation de" 530 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 531 echo "été faite ; ou une option qui est supportée par le client mais" 532 echo "pas par le serveur a été spécifiée." 533 return;; 534 10) echo "Erreur de rsync ; RERR_SOCKETIO" 535 echo "Erreur dans le socket d'entrée sortie" 536 return;; 537 11) echo "Erreur de rsync ; RERR_FILEIO" 538 echo "Erreur d'entrée sortie fichier" 539 return;; 540 12) echo "Erreur de rsync ; RERR_STREAMIO" 541 echo "Erreur dans flux de donnée du protocole rsync" 542 return;; 543 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 544 echo "Erreur avec les diagnostics du programme" 545 return;; 546 14) echo "Erreur de rsync ; RERR_IPC" 547 echo "Erreur dans le code IPC" 548 return;; 549 20) echo "Erreur de rsync ; RERR_SIGNAL" 550 echo "SIGUSR1 ou SIGINT reçu" 551 return;; 552 21) echo "Erreur de rsync ; RERR_WAITCHILD" 553 echo "Une erreur retournée par waitpid()" 554 return;; 555 22) echo "Erreur de rsync ; RERR_MALLOC" 556 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 557 return;; 558 23) echo "" 559 echo "Erreur fichier inexistant" 560 return;; 561 30) echo "Erreur de rsync ; RERR_TIMEOUT" 562 echo "Temps d'attente écoulé dans l'envoi/réception de données" 563 return;; 564 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 565 return;; 566 esac 567 elif [ $MYLANG = "en" ] ; then 568 case $RET in 569 0) return;; 570 1) echo "rsync error : Syntax or usage error " 571 return;; 572 2) echo "rsync error : Protocol incompatibility " 573 return;; 574 3) echo "rsync error : Errors selecting input/output files, dirs" 575 return;; 576 4) echo "rsync error : Requested action not supported: an attempt" 577 echo "was made to manipulate 64-bit files on a platform that cannot support" 578 echo "them; or an option was specified that is supported by the client and" 579 echo "not by the server." 580 return;; 581 5) echo "rsync error : Error starting client-server protocol" 582 return;; 583 10) echo "rsync error : Error in socket I/O " 584 return;; 585 11) echo "rsync error : Error in file I/O " 586 return;; 587 12) echo "rsync error : Error in rsync protocol data stream " 588 return;; 589 13) echo "rsync error : Errors with program diagnostics " 590 return;; 591 14) echo "rsync error : Error in IPC code " 592 return;; 593 20) echo "rsync error : Received SIGUSR1 or SIGINT " 594 return;; 595 21) echo "rsync error : Some error returned by waitpid() " 596 return;; 597 22) echo "rsync error : Error allocating core memory buffers " 598 return;; 599 23) echo "rsync error : Partial transfer due to error" 600 return;; 601 24) echo "rsync error : Partial transfer due to vanished source files" 602 return;; 603 30) echo "rsync error : Timeout in data send/receive " 604 return;; 605 *) echo "rsync error : return code of rsync unknown :" $RET 606 return;; 607 esac 608 else 609 echo "unknown language $MYLANG." 610 return 611 fi 612 } 613 610 614 #D-#================================================== 611 615 #D-function IGCM_sys_Cp … … 614 618 #D- 615 619 function IGCM_sys_Cp { 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 620 IGCM_debug_PushStack "IGCM_sys_Cp" $@ 621 if ( $DEBUG_sys ) ; then 622 echo "IGCM_sys_Cp :" $@ 623 fi 624 625 typeset RET 626 627 echo cp $@ > out_rsync 2>&1 628 \cp $@ >> out_rsync 2>&1 629 RET=$? 630 631 if [ ${RET} -gt 0 ] ; then 632 echo "IGCM_sys_Cp : error." 633 cat out_rsync 634 IGCM_debug_Exit "IGCM_sys_Cp" 635 fi 636 IGCM_debug_PopStack "IGCM_sys_Cp" 633 637 } 634 638 … … 639 643 #D- 640 644 function IGCM_sys_Rm { 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 645 IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 646 if ( $DEBUG_sys ) ; then 647 echo "IGCM_sys_Rm :" $@ 648 fi 649 650 typeset RET 651 652 echo rm $@ > out_rsync 2>&1 653 \rm $@ >> out_rsync 2>&1 654 RET=$? 655 656 if [ ${RET} -gt 0 ] ; then 657 echo "IGCM_sys_Rm : error." 658 cat out_rsync 659 IGCM_debug_Exit "IGCM_sys_Rm" 660 fi 661 IGCM_debug_PopStack "IGCM_sys_Rm" 658 662 } 659 663 … … 665 669 #D- 666 670 function IGCM_sys_RmRunDir { 667 668 669 670 671 672 671 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 672 if ( $DEBUG_sys ) ; then 673 echo "IGCM_sys_RmRunDir :" $@ 674 echo "Dummy call, let the scheduler do that." 675 fi 676 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 673 677 } 674 678 … … 679 683 #D- 680 684 function IGCM_sys_Mv { 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 685 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 686 if ( $DEBUG_sys ) ; then 687 echo "IGCM_sys_Mv :" $@ 688 fi 689 690 if [ $DRYRUN = 0 ]; then 691 692 typeset RET 693 694 echo mv $@ > out_rsync 2>&1 695 \mv $@ >> out_rsync 2>&1 696 RET=$? 697 698 if [ ${RET} -gt 0 ] ; then 699 echo "IGCM_sys_Mv : error in mv." 700 cat out_rsync 701 IGCM_debug_Exit "IGCM_sys_Mv" 702 fi 703 else 704 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 705 fi 706 707 IGCM_debug_PopStack "IGCM_sys_Mv" 704 708 } 705 709 … … 710 714 #D- 711 715 function IGCM_sys_Put_Dir { 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 716 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 717 if ( $DEBUG_sys ) ; then 718 echo "IGCM_sys_Put_Dir :" $@ 719 fi 720 if [ $DRYRUN = 0 ]; then 721 if [ ! -d ${1} ] ; then 722 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 723 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 724 return 725 fi 726 727 typeset RET 728 729 # Only if we use rsync 730 #IGCM_sys_TestDirArchive $( dirname $2 ) 731 # 732 #USUAL WAY 733 rcp -r $1 gaya:$2 > out_rsync 2>&1 734 RET=$? 735 736 if [ ${RET} -gt 0 ] ; then 737 echo "IGCM_sys_Put_Dir : error." 738 cat out_rsync 739 IGCM_debug_Exit "IGCM_sys_Put_Dir" 740 fi 741 742 # due to rcommand latency 743 sleep 10 744 745 else 746 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 747 fi 748 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 745 749 } 746 750 … … 751 755 #D- 752 756 function IGCM_sys_Get_Dir { 753 754 755 756 757 757 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 758 if ( $DEBUG_sys ) ; then 759 echo "IGCM_sys_Get_Dir :" $@ 760 fi 761 if [ $DRYRUN = 0 ]; then 758 762 # if [ ! -d ${1} ] ; then 759 # 760 # 761 # 763 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 764 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 765 # return 762 766 # fi 763 767 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 768 typeset RET 769 770 #USUAL WAY 771 rcp -rp gaya:$1 $2 > out_rsync 2>&1 772 RET=$? 773 774 if [ ${RET} -gt 0 ] ; then 775 echo "IGCM_sys_Get_Dir : error." 776 cat out_rsync 777 IGCM_debug_Exit "IGCM_sys_Get_Dir" 778 fi 779 else 780 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 781 fi 782 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 779 783 } 780 784 … … 785 789 #D- 786 790 function IGCM_sys_Get_Master { 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 791 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 792 if ( $DEBUG_sys ) ; then 793 echo "IGCM_sys_Get_Master :" $@ 794 fi 795 if [ $DRYRUN = 0 ]; then 796 TEST=$( IGCM_sys_RshMaster [ -d $1 ] && echo 1 || echo 0 ) 797 if [ ${TEST} -ne 1 ] ; then 798 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ON ${MASTER}." 799 IGCM_debug_PopStack "IGCM_sys_Get_Master" 800 return 801 fi 802 803 typeset RET 804 805 #USUAL WAY 806 rcp -r ${MASTER}:$1 $2 > out_rsync 2>&1 807 RET=$? 808 809 if [ ${RET} -gt 0 ] ; then 810 echo "IGCM_sys_Get_Master : error." 811 cat out_rsync 812 IGCM_debug_Exit "IGCM_sys_Get_Master" 813 fi 814 else 815 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 816 fi 817 IGCM_debug_PopStack "IGCM_sys_Get_Master" 814 818 } 815 819 … … 820 824 #D- 821 825 function IGCM_sys_Put_Out { 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 # 847 # 848 # 849 850 # 851 # 852 # 853 854 # 855 # 856 857 # 858 # 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 826 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 827 if ( $DEBUG_sys ) ; then 828 echo "IGCM_sys_Put_Out :" $@ 829 fi 830 if [ $DRYRUN = 0 ]; then 831 if [ ! -f ${1} ] ; then 832 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 833 IGCM_debug_PopStack "IGCM_sys_Put_Out" 834 return 1 835 fi 836 837 typeset RET 838 # 839 if [ X${JobType} = XRUN ] ; then 840 if [ X${3} = X ] ; then 841 IGCM_sys_Chmod 444 ${1} 842 fi 843 fi 844 # 845 # 846 # USUAL WAY 847 mfput $1 $2 > out_rsync 2>&1 848 RET=$? 849 850 # #RSYNC WITH NETWORK RSH CALL 851 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 852 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 853 854 # #RSYNC WITH NFS USE 855 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 856 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 857 858 # RET=$? 859 # IGCM_sys_Rsync_out $RET 860 861 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 862 # (( RET=RET+$? )) 863 864 if [ ${RET} -gt 0 ] ; then 865 echo "IGCM_sys_Put_Out : error." 866 cat out_rsync 867 IGCM_debug_Print 1 "mfput failed. Make a second try :" 868 # 869 mfput $1 $2 > out_rsync 2>&1 870 RET=$? 871 # 872 if [ ${RET} -gt 0 ] ; then 873 echo "IGCM_sys_Put_Out : error." 874 IGCM_debug_Print 1 "mfput failed twice. You have a problem" 875 cat out_rsync 876 IGCM_debug_Exit "IGCM_sys_Put_Out" 877 fi 878 fi 879 else 880 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 881 fi 882 IGCM_debug_PopStack "IGCM_sys_Put_Out" 883 return 0 880 884 } 881 885 … … 886 890 #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ 887 891 function IGCM_sys_Get { 888 889 890 891 892 893 894 895 896 892 IGCM_debug_PushStack "IGCM_sys_Get" $@ 893 894 typeset DEST RET dm_liste ifile target 895 896 if ( $DEBUG_sys ) ; then 897 echo "IGCM_sys_Get :" $@ 898 fi 899 if [ $DRYRUN -le 2 ]; then 900 if [ X${1} = X'/l' ] ; then 897 901 # test if the first file is present in the old computation : 898 899 900 901 902 903 904 905 906 902 eval set +A dm_liste \${${2}} 903 else 904 dm_liste=${1} 905 fi 906 eval DEST=\${${#}} 907 908 # test if the (first) file is present in the old computation : 909 IGCM_sys_TestFileArchive ${dm_liste[0]} 910 RET=$? 907 911 if [ ${RET} -gt 0 ] ; then 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 # 931 # 932 # 933 934 # 935 # 936 # 937 938 # 939 # 940 941 # 942 # 943 944 945 946 947 948 }912 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 913 IGCM_debug_Exit "IGCM_sys_Get" 914 #IGCM_debug_PopStack "IGCM_sys_Get" 915 #return 916 fi 917 918 # SD : dm_liste is not suited for computing job 919 # because we change filename during transfert 920 # dm_liste is better suited for post-treatment 921 # SD : dm_liste necessary only with RSYNC 922 923 #dm_liste=" " 924 #(( ifile=1 )) 925 #while [ $ifile -lt $# ] ; do 926 # dm_liste=$( eval echo ${dm_liste[*]} " "\${${ifile}} ) 927 # (( ifile = ifile + 1 )) 928 #done 929 #DEST=$( eval echo \${${#}} ) 930 931 #USUAL WAY 932 mfget ${dm_liste[*]} ${DEST} > out_rsync 2>&1 933 934 # #RSYNC WITH NETWORK RSH CALL 935 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 936 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 937 938 # #RSYNC WITH NFS USE 939 # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 940 # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 941 942 # RET=$? 943 # IGCM_sys_Rsync_out $RET 944 945 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 946 # (( RET=RET+$? )) 947 948 else 949 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 950 fi 951 IGCM_debug_PopStack "IGCM_sys_Get" 952 } 949 953 950 954 #D-#================================================== … … 953 957 #D-* Examples: 954 958 #D- 955 function IGCM_sys_Put_Dods {956 IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@957 if ( $DEBUG_sys ) ; then958 959 fi960 if [ $DRYRUN = 0 ]; then961 962 963 IGCM_sys_TestDirArchive ${R_SAVE}/${1} 964 965 966 967 968 969 970 971 972 973 cd ${R_SAVE}974 /usr/local/bin/dods_rm DODS/pub/${LOGIN}/${R_DODS}/${1} > /dev/null 2>&1975 /bin/chmod -R u+w ${R_SAVE}/${1}976 /usr/local/bin/dods_cp ${1} DODS/pub/${LOGIN}/${R_DODS} > /dev/null 2>&1977 /bin/chmod -R +rX ${R_SAVE}/${1}978 979 EOF980 RET=$?981 982 983 984 985 986 else987 988 fi989 IGCM_debug_PopStack "IGCM_sys_Put_Dods"990 }959 function IGCM_sys_Put_Dods { 960 IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ 961 if ( $DEBUG_sys ) ; then 962 echo "IGCM_sys_Put_Dods :" $@ 963 fi 964 if [ $DRYRUN = 0 ]; then 965 # We take our time on that 966 sleep 10 967 IGCM_sys_TestDirArchive ${R_SAVE}/${1} 968 if [ $? != 0 ] ; then 969 echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ." 970 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 971 return 972 fi 973 974 typeset RET 975 # 976 rsh gaya exec /bin/ksh <<EOF 977 cd ${R_SAVE} 978 /usr/local/bin/dods_rm DODS/pub/${LOGIN}/${R_DODS}/${1} > /dev/null 2>&1 979 /bin/chmod -R u+w ${R_SAVE}/${1} 980 /usr/local/bin/dods_cp ${1} DODS/pub/${LOGIN}/${R_DODS} > /dev/null 2>&1 981 /bin/chmod -R +rX ${R_SAVE}/${1} 982 /bin/chmod -R u+w ${R_SAVE}/${1} 983 EOF 984 RET=$? 985 986 if [ ${RET} -gt 0 ] ; then 987 echo "IGCM_sys_Put_Dods : error." 988 IGCM_debug_Exit "IGCM_sys_Put_Dods" 989 fi 990 else 991 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 992 fi 993 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 994 } 991 995 992 996 ############################################################## A FINIR !! … … 997 1001 #D-* Examples: 998 1002 #D- 999 function IGCM_sys_GetDate_FichWork {1000 IGCM_debug_PushStack "IGCM_sys_FichWork" $@1001 if ( $DEBUG_sys ) ; then1002 1003 fi1003 function IGCM_sys_GetDate_FichWork { 1004 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1005 if ( $DEBUG_sys ) ; then 1006 echo "IGCM_sys_GetDate_FichWork :" $@ 1007 fi 1004 1008 # donne la date filesys d'un fichier sur la machine work 1005 IGCM_debug_PopStack "IGCM_sys_FichWork"1006 }1009 IGCM_debug_PopStack "IGCM_sys_FichWork" 1010 } 1007 1011 1008 1012 #D-#================================================== 1009 1013 #D-function IGCM_sys_GetDate_FichArchive 1010 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1011 #D-* Examples: 1012 #D- 1013 function IGCM_sys_GetDate_FichArchive {1014 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@1015 if ( $DEBUG_sys ) ; then1016 1017 fi1018 IGCM_debug_PopStack "IGCM_sys_FichArchive"1019 }1014 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1015 #D-* Examples: 1016 #D- 1017 function IGCM_sys_GetDate_FichArchive { 1018 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1019 if ( $DEBUG_sys ) ; then 1020 echo "IGCM_sys_GetDate_FichArchive :" $@ 1021 fi 1022 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1023 } 1020 1024 1021 1025 ############################################################## 1022 1026 # REBUILD OPERATOR 1023 1027 1024 function IGCM_sys_rebuild {1025 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@1026 if ( $DEBUG_sys ) ; then1027 1028 fi1029 /home/rech/psl/rpsl035/bin/rebuild -f -o $@1030 if [ $? -gt 0 ] ; then1031 echo "IGCM_sys_rebuild : erreur ${@}."1032 IGCM_debug_Exit "rebuild"1033 fi1034 1035 IGCM_debug_PopStack "IGCM_sys_rebuild"1036 }1028 function IGCM_sys_rebuild { 1029 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1030 if ( $DEBUG_sys ) ; then 1031 echo "IGCM_sys_rebuild :" $@ 1032 fi 1033 /home/rech/psl/rpsl035/bin/rebuild -f -o $@ 1034 if [ $? -gt 0 ] ; then 1035 echo "IGCM_sys_rebuild : erreur ${@}." 1036 IGCM_debug_Exit "rebuild" 1037 fi 1038 1039 IGCM_debug_PopStack "IGCM_sys_rebuild" 1040 } 1037 1041 ############################################################## 1038 1042 # NCO OPERATOR 1039 1043 1040 function IGCM_sys_ncap2 {1041 IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@1042 if ( $DEBUG_sys ) ; then1043 1044 fi1045 ncap2 "$@"1046 if [ $? -gt 0 ] ; then1047 echo "IGCM_sys_ncap2 : erreur ${@}."1048 IGCM_debug_Exit "ncap2"1049 fi1050 1051 IGCM_debug_PopStack "IGCM_sys_ncap2"1052 }1053 1054 function IGCM_sys_ncatted {1055 IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@1056 if ( $DEBUG_sys ) ; then1057 1058 fi1059 ncatted "$@"1060 if [ $? -gt 0 ] ; then1061 echo "IGCM_sys_ncatted : erreur ${@}."1062 IGCM_debug_Exit "ncatted"1063 fi1064 1065 IGCM_debug_PopStack "IGCM_sys_ncatted"1066 }1067 1068 function IGCM_sys_ncbo {1069 IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@1070 if ( $DEBUG_sys ) ; then1071 1072 fi1073 ncbo $@1074 if [ $? -gt 0 ] ; then1075 echo "IGCM_sys_ncbo : erreur ${@}."1076 IGCM_debug_Exit "ncbo"1077 fi1078 1079 IGCM_debug_PopStack "IGCM_sys_ncbo"1080 }1081 1082 function IGCM_sys_ncdiff {1083 IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@1084 if ( $DEBUG_sys ) ; then1085 1086 fi1087 ncdiff $@1088 if [ $? -gt 0 ] ; then1089 echo "IGCM_sys_ncdiff : erreur ${@}."1090 IGCM_debug_Exit "ncdiff"1091 fi1092 1093 IGCM_debug_PopStack "IGCM_sys_ncdiff"1094 }1095 1096 function IGCM_sys_ncea {1097 IGCM_debug_PushStack "IGCM_sys_ncea" -- $@1098 if ( $DEBUG_sys ) ; then1099 1100 fi1101 ncea $@1102 if [ $? -gt 0 ] ; then1103 echo "IGCM_sys_ncea : erreur ${@}."1104 IGCM_debug_Exit "ncea"1105 fi1106 1107 IGCM_debug_PopStack "IGCM_sys_ncea"1108 }1109 1110 function IGCM_sys_ncecat {1111 IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@1112 if ( $DEBUG_sys ) ; then1113 1114 fi1115 ncecat $@1116 if [ $? -gt 0 ] ; then1117 echo "IGCM_sys_ncecat : erreur ${@}."1118 IGCM_debug_Exit "ncecat"1119 fi1120 1121 IGCM_debug_PopStack "IGCM_sys_ncecat"1122 }1123 1124 function IGCM_sys_ncflint {1125 IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@1126 if ( $DEBUG_sys ) ; then1127 1128 fi1129 ncflint $@1130 if [ $? -gt 0 ] ; then1131 echo "IGCM_sys_ncflint : erreur ${@}."1132 IGCM_debug_Exit "ncflint"1133 fi1134 1135 IGCM_debug_PopStack "IGCM_sys_ncflint"1136 }1137 1138 function IGCM_sys_ncks {1139 IGCM_debug_PushStack "IGCM_sys_ncks" -- $@1140 if ( $DEBUG_sys ) ; then1141 1142 fi1143 ncks $@1144 if [ $? -gt 0 ] ; then1145 echo "IGCM_sys_ncks : erreur ${@}."1146 IGCM_debug_Exit "ncks"1147 fi1148 1149 IGCM_debug_PopStack "IGCM_sys_ncks"1150 }1151 1152 function IGCM_sys_ncpdq {1153 IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@1154 if ( $DEBUG_sys ) ; then1155 1156 fi1157 ncpdq $@1158 if [ $? -gt 0 ] ; then1159 echo "IGCM_sys_ncpdq : erreur ${@}."1160 IGCM_debug_Exit "ncpdq"1161 fi1162 1163 IGCM_debug_PopStack "IGCM_sys_ncpdq"1164 }1165 1166 function IGCM_sys_ncra {1167 IGCM_debug_PushStack "IGCM_sys_ncra" -- $@1168 if ( $DEBUG_sys ) ; then1169 1170 fi1171 ncra $@1172 if [ $? -gt 0 ] ; then1173 echo "IGCM_sys_ncra : erreur ${@}."1174 IGCM_debug_Exit "ncra"1175 fi1176 1177 IGCM_debug_PopStack "IGCM_sys_ncra"1178 }1179 1180 function IGCM_sys_ncrcat {1181 IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@1182 if ( $DEBUG_sys ) ; then1183 1184 fi1185 ncrcat $@1186 if [ $? -gt 0 ] ; then1187 echo "IGCM_sys_ncrcat : erreur ${@}."1044 function IGCM_sys_ncap2 { 1045 IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 1046 if ( $DEBUG_sys ) ; then 1047 echo "IGCM_sys_ncap2 :" $@ 1048 fi 1049 ncap2 "$@" 1050 if [ $? -gt 0 ] ; then 1051 echo "IGCM_sys_ncap2 : erreur ${@}." 1052 IGCM_debug_Exit "ncap2" 1053 fi 1054 1055 IGCM_debug_PopStack "IGCM_sys_ncap2" 1056 } 1057 1058 function IGCM_sys_ncatted { 1059 IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 1060 if ( $DEBUG_sys ) ; then 1061 echo "IGCM_sys_ncatted :" $@ 1062 fi 1063 ncatted "$@" 1064 if [ $? -gt 0 ] ; then 1065 echo "IGCM_sys_ncatted : erreur ${@}." 1066 IGCM_debug_Exit "ncatted" 1067 fi 1068 1069 IGCM_debug_PopStack "IGCM_sys_ncatted" 1070 } 1071 1072 function IGCM_sys_ncbo { 1073 IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 1074 if ( $DEBUG_sys ) ; then 1075 echo "IGCM_sys_ncbo :" $@ 1076 fi 1077 ncbo $@ 1078 if [ $? -gt 0 ] ; then 1079 echo "IGCM_sys_ncbo : erreur ${@}." 1080 IGCM_debug_Exit "ncbo" 1081 fi 1082 1083 IGCM_debug_PopStack "IGCM_sys_ncbo" 1084 } 1085 1086 function IGCM_sys_ncdiff { 1087 IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 1088 if ( $DEBUG_sys ) ; then 1089 echo "IGCM_sys_ncdiff :" $@ 1090 fi 1091 ncdiff $@ 1092 if [ $? -gt 0 ] ; then 1093 echo "IGCM_sys_ncdiff : erreur ${@}." 1094 IGCM_debug_Exit "ncdiff" 1095 fi 1096 1097 IGCM_debug_PopStack "IGCM_sys_ncdiff" 1098 } 1099 1100 function IGCM_sys_ncea { 1101 IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 1102 if ( $DEBUG_sys ) ; then 1103 echo "IGCM_sys_ncea :" $@ 1104 fi 1105 ncea $@ 1106 if [ $? -gt 0 ] ; then 1107 echo "IGCM_sys_ncea : erreur ${@}." 1108 IGCM_debug_Exit "ncea" 1109 fi 1110 1111 IGCM_debug_PopStack "IGCM_sys_ncea" 1112 } 1113 1114 function IGCM_sys_ncecat { 1115 IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 1116 if ( $DEBUG_sys ) ; then 1117 echo "IGCM_sys_ncecat :" $@ 1118 fi 1119 ncecat $@ 1120 if [ $? -gt 0 ] ; then 1121 echo "IGCM_sys_ncecat : erreur ${@}." 1122 IGCM_debug_Exit "ncecat" 1123 fi 1124 1125 IGCM_debug_PopStack "IGCM_sys_ncecat" 1126 } 1127 1128 function IGCM_sys_ncflint { 1129 IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 1130 if ( $DEBUG_sys ) ; then 1131 echo "IGCM_sys_ncflint :" $@ 1132 fi 1133 ncflint $@ 1134 if [ $? -gt 0 ] ; then 1135 echo "IGCM_sys_ncflint : erreur ${@}." 1136 IGCM_debug_Exit "ncflint" 1137 fi 1138 1139 IGCM_debug_PopStack "IGCM_sys_ncflint" 1140 } 1141 1142 function IGCM_sys_ncks { 1143 IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 1144 if ( $DEBUG_sys ) ; then 1145 echo "IGCM_sys_ncks :" $@ 1146 fi 1147 ncks $@ 1148 if [ $? -gt 0 ] ; then 1149 echo "IGCM_sys_ncks : erreur ${@}." 1150 IGCM_debug_Exit "ncks" 1151 fi 1152 1153 IGCM_debug_PopStack "IGCM_sys_ncks" 1154 } 1155 1156 function IGCM_sys_ncpdq { 1157 IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 1158 if ( $DEBUG_sys ) ; then 1159 echo "IGCM_sys_ncpdq :" $@ 1160 fi 1161 ncpdq $@ 1162 if [ $? -gt 0 ] ; then 1163 echo "IGCM_sys_ncpdq : erreur ${@}." 1164 IGCM_debug_Exit "ncpdq" 1165 fi 1166 1167 IGCM_debug_PopStack "IGCM_sys_ncpdq" 1168 } 1169 1170 function IGCM_sys_ncra { 1171 IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 1172 if ( $DEBUG_sys ) ; then 1173 echo "IGCM_sys_ncra :" $@ 1174 fi 1175 ncra $@ 1176 if [ $? -gt 0 ] ; then 1177 echo "IGCM_sys_ncra : erreur ${@}." 1178 IGCM_debug_Exit "ncra" 1179 fi 1180 1181 IGCM_debug_PopStack "IGCM_sys_ncra" 1182 } 1183 1184 function IGCM_sys_ncrcat { 1185 IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 1186 if ( $DEBUG_sys ) ; then 1187 echo "IGCM_sys_ncrcat :" $@ 1188 fi 1189 ncrcat $@ 1190 if [ $? -gt 0 ] ; then 1191 echo "IGCM_sys_ncrcat : erreur ${@}." 1188 1192 # IGCM_debug_Exit "ncrcat" 1189 fi1190 1191 IGCM_debug_PopStack "IGCM_sys_ncrcat"1192 }1193 1194 function IGCM_sys_ncrename {1195 IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@1196 if ( $DEBUG_sys ) ; then1197 1198 fi1199 ncrename $@1200 if [ $? -gt 0 ] ; then1201 echo "IGCM_sys_ncrename : erreur ${@}."1202 IGCM_debug_Exit "ncrename"1203 fi1204 1205 IGCM_debug_PopStack "IGCM_sys_ncrename"1206 }1207 1208 function IGCM_sys_ncwa {1209 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@1210 if ( $DEBUG_sys ) ; then1211 1212 fi1213 ncwa $@1214 if [ $? -gt 0 ] ; then1215 echo "IGCM_sys_ncwa : erreur ${@}."1216 IGCM_debug_Exit "ncwa"1217 fi1218 1219 IGCM_debug_PopStack "IGCM_sys_ncwa"1220 }1193 fi 1194 1195 IGCM_debug_PopStack "IGCM_sys_ncrcat" 1196 } 1197 1198 function IGCM_sys_ncrename { 1199 IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 1200 if ( $DEBUG_sys ) ; then 1201 echo "IGCM_sys_ncrename :" $@ 1202 fi 1203 ncrename $@ 1204 if [ $? -gt 0 ] ; then 1205 echo "IGCM_sys_ncrename : erreur ${@}." 1206 IGCM_debug_Exit "ncrename" 1207 fi 1208 1209 IGCM_debug_PopStack "IGCM_sys_ncrename" 1210 } 1211 1212 function IGCM_sys_ncwa { 1213 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 1214 if ( $DEBUG_sys ) ; then 1215 echo "IGCM_sys_ncwa :" $@ 1216 fi 1217 ncwa $@ 1218 if [ $? -gt 0 ] ; then 1219 echo "IGCM_sys_ncwa : erreur ${@}." 1220 IGCM_debug_Exit "ncwa" 1221 fi 1222 1223 IGCM_debug_PopStack "IGCM_sys_ncwa" 1224 } 1221 1225 1222 1226 ############################################################## 1223 1227 # CDO OPERATOR 1224 1228 1225 function IGCM_sys_cdo {1226 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@1227 1228 \cdo $@1229 if [ $? -gt 0 ] ; then1230 echo "IGCM_sys_cdo : erreur ${@}."1231 IGCM_debug_PopStack "IGCM_sys_cdo"1232 return 11233 else1234 1235 1236 fi1237 1238 IGCM_debug_PopStack "IGCM_sys_cdo"1239 }1229 function IGCM_sys_cdo { 1230 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 1231 1232 \cdo $@ 1233 if [ $? -gt 0 ] ; then 1234 echo "IGCM_sys_cdo : erreur ${@}." 1235 IGCM_debug_PopStack "IGCM_sys_cdo" 1236 return 1 1237 else 1238 IGCM_debug_PopStack "IGCM_sys_cdo" 1239 return 0 1240 fi 1241 1242 IGCM_debug_PopStack "IGCM_sys_cdo" 1243 } 1240 1244 1241 1245 ############################################################ 1242 1246 # Activate Running Environnment Variables 1243 1247 1244 function IGCM_sys_activ_variables {1245 IGCM_debug_PushStack "IGCM_sys_activ_variables"1246 if ( $DEBUG_sys ) ; then1247 1248 fi1249 IGCM_debug_PopStack "IGCM_sys_activ_variables"1250 }1248 function IGCM_sys_activ_variables { 1249 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1250 if ( $DEBUG_sys ) ; then 1251 echo "IGCM_sys_activ_variables" 1252 fi 1253 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1254 } 1251 1255 1252 1256 ############################################################ 1253 1257 # Desactivate Running Environnment Variables 1254 1258 1255 function IGCM_sys_desactiv_variables {1256 IGCM_debug_PushStack "IGCM_sys_desactiv_variables"1257 if ( $DEBUG_sys ) ; then1258 1259 fi1260 IGCM_debug_PopStack "IGCM_sys_desactiv_variables"1261 }1259 function IGCM_sys_desactiv_variables { 1260 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1261 if ( $DEBUG_sys ) ; then 1262 echo "IGCM_sys_desactiv_variables" 1263 fi 1264 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1265 } 1262 1266 1263 1267 ############################################################ 1264 1268 # Build run file 1265 1269 1266 function IGCM_sys_build_run_file {1267 IGCM_debug_PushStack "IGCM_sys_build_run_file"1268 if ( $DEBUG_sys ) ; then1269 1270 fi1271 IGCM_debug_PopStack "IGCM_sys_build_run_file"1272 }1270 function IGCM_sys_build_run_file { 1271 IGCM_debug_PushStack "IGCM_sys_build_run_file" 1272 if ( $DEBUG_sys ) ; then 1273 echo "IGCM_sys_build_run_file" 1274 fi 1275 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1276 } -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_vargas.ksh
r567 r619 14 14 #========================================================= 15 15 # The documentation of this file can be automatically generated 16 # if you use the prefix #D- for comments to be extracted. 16 # if you use the prefix #D- for comments to be extracted. 17 17 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 18 18 #========================================================= … … 22 22 #D-#================================================== 23 23 #D- 24 #D- This ksh library if a layer under some usefull 24 #D- This ksh library if a layer under some usefull 25 25 #D-environment variables and shell commands. 26 26 #D-All those definitions depend on host particularities. … … 62 62 63 63 #===================================================== 64 # Host and user names 64 # Host and user names 65 65 # $hostname ou hostname 66 66 typeset HOST=${HOST:=$( hostname )} … … 100 100 101 101 #==================================================== 102 #- Mirror libIGCM from vargas to ulam 102 #- Mirror libIGCM from vargas to ulam 103 103 typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true} 104 104 … … 119 119 120 120 #==================================================== 121 #- OUT_POST 121 #- R_BUF Buffer to pack files 122 typeset -r R_BUF=${WORKDIR}/IGCM_OUT 123 124 #==================================================== 125 #- OUT_POST 122 126 typeset -r R_OUT_POST=$( echo ${HOME} | sed -e "s/homegpfs/workdir/" )/IGCM_OUT 123 127 … … 136 140 #==================================================== 137 141 #- Max number of arguments passed to nco operator or demigration command 138 UNIX_MAX_LIMIT=360 142 UNIX_MAX_LIMIT=120 143 144 #==================================================== 145 #- Default number of MPI task for IPSL coupled model 146 #- required for backward compatibility 147 #- 148 DEFAULT_NUM_PROC_OCE=5 149 DEFAULT_NUM_PROC_CPL=1 150 DEFAULT_NUM_PROC_ATM=26 151 DEFAULT_NUM_PROC_TOTAL=32 139 152 140 153 #D-#================================================== … … 145 158 (( RshMNum = 0 )) 146 159 function IGCM_sys_RshMaster { 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 160 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 161 162 typeset THEFILE OUTFILE ERR 163 164 RshDIR=${WORKDIR}/RUN_DIR/${config_UserChoices_TagName}/${config_UserChoices_JobName}.${$} 165 if [ ! -d ${RshDIR} ] ; then 166 IGCM_sys_Mkdir ${RshDIR} 167 fi 168 THEFILE=${RshDIR}/file_sys_RshMaster_$$_${RshMNum} 169 echo '#!/bin/ksh' > ${THEFILE} 170 echo "export libIGCM=${libIGCM} > /dev/null 2>&1" >> ${THEFILE} 171 echo "export DEBUG_debug=${DEBUG_debug} > /dev/null 2>&1" >> ${THEFILE} 172 echo ". ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh > /dev/null 2>&1" >> ${THEFILE} 173 echo ". ${libIGCM}/libIGCM_card/libIGCM_card.ksh > /dev/null 2>&1" >> ${THEFILE} 174 echo "${@} " >> ${THEFILE} 162 175 163 176 # No frontend queue on brodie : just rsh the job on the frontend with submission. 164 165 166 167 168 169 170 171 172 173 174 175 176 177 sed -e "s@IGCM_sys_Qsub\(.*\)@\1@" ${THEFILE} > ${THEFILE}_ 178 179 chmod u+x ${THEFILE}_ 180 181 OUTFILE=${RshDIR}/out_RshMaster.$$.${RshMNum} 182 (( RshMNum = RshMNum + 1 )) 183 184 rsh ${MASTER} 'bash -c "nohup '${THEFILE}'_ > '${OUTFILE}' 2>&1 &"' 185 if [ $? -gt 0 ] ; then 186 echo "IGCM_sys_RshMaster : erreur." 187 IGCM_debug_Exit "IGCM_sys_RshMaster" 188 fi 189 IGCM_debug_PopStack "IGCM_sys_RshMaster" 177 190 } 178 191 … … 183 196 #D- 184 197 function IGCM_sys_RshArchive { 185 186 198 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 199 rsh ${STOREHOST} exec /bin/ksh <<-EOF 187 200 ${@} 188 201 EOF 189 190 191 192 193 202 if [ $? -gt 0 ] ; then 203 echo "IGCM_sys_RshArchive : erreur." 204 IGCM_debug_Exit "IGCM_sys_RshArchive" 205 fi 206 IGCM_debug_PopStack "IGCM_sys_RshArchive" 194 207 } 195 208 … … 200 213 #D- 201 214 function IGCM_sys_RshPost { 202 203 204 205 206 207 208 cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGIN}209 210 211 212 213 grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$_${LOGIN} >/dev/null 2>&1 && ISITQSUB=1214 if ( [ ${ISITQSUB} -gt 0 ] ) ; then215 216 for postponed_file in ${SUBMIT_DIR}/POSTPONE/* ; do217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 rsh ulam exec /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGIN}233 234 235 236 237 IGCM_debug_Print 2 "Postpone tmp_IGCM_sys_RshPost_$$_${LOGIN}"238 239 mv /tmp/tmp_IGCM_sys_RshPost_$$_${LOGIN} ${SUBMIT_DIR}/POSTPONE240 241 \rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGIN}242 243 215 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 216 if ( $DEBUG_sys ) ; then 217 echo "IGCM_sys_RshPost :" $@ 218 fi 219 220 # keep standard input to keep it for postpone if ulam don't answer 221 cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 222 223 ## Add submission for old postponed files only if command is a Qsub 224 ## 225 ISITQSUB=0 226 grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} >/dev/null 2>&1 && ISITQSUB=1 227 if ( [ ${ISITQSUB} -gt 0 ] ) ; then 228 if [ -d ${SUBMIT_DIR}/POSTPONE ] ; then 229 for postponed_file in ${SUBMIT_DIR}/POSTPONE/* ; do 230 if [ -f ${postponed_file} ] ; then 231 IGCM_debug_Print 2 " submit postponed file : " ${postponed_file} 232 rsh ulam exec /bin/ksh <${postponed_file} 233 if [ $? -eq 0 ] ; then 234 IGCM_sys_Rm ${postponed_file} 235 else 236 IGCM_debug_Print 2 "keep postponed file for an other submission :" ${postponed_file} 237 fi 238 fi 239 done 240 fi 241 fi 242 243 RETURN=0 244 # rsh ulam command 245 rsh ulam exec /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 246 RETURN=$? 247 248 # keep standard input for postpone if ulam don't answer 249 if ( [ ${RETURN} -gt 0 ] ) ; then 250 IGCM_debug_Print 2 "Postpone tmp_IGCM_sys_RshPost_$$_${LOGNAME}" 251 [ -d ${SUBMIT_DIR}/POSTPONE ] || mkdir ${SUBMIT_DIR}/POSTPONE 252 mv /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} ${SUBMIT_DIR}/POSTPONE 253 else 254 IGCM_sys_Rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 255 fi 256 IGCM_debug_PopStack "IGCM_sys_RshPost" 244 257 } 245 258 … … 250 263 #D- 251 264 function IGCM_sys_SendMail { 252 253 254 255 256 257 258 259 260 261 262 265 IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 266 if ( $DEBUG_sys ) ; then 267 echo "IGCM_sys_SendMail :" $@ 268 fi 269 270 if ( ${ExitFlag} ) ; then 271 status=failed 272 else 273 status=completed 274 fi 275 cat << END_MAIL > job_end.mail 263 276 Dear ${LOGIN}, 264 277 … … 270 283 END_MAIL 271 284 272 273 274 275 276 277 278 279 280 281 282 283 284 285 if [ ! -z ${config_UserChoices_MailName} ] ; then 286 mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 287 elif [ -f ~/.forward ] ; then 288 mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 289 else 290 mailx -s "${config_UserChoices_JobName} ${status}" ${USER} < job_end.mail 291 fi 292 293 if [ $? -gt 0 ] ; then 294 echo "IGCM_sys_SendMail : erreur." 295 IGCM_debug_Exit "IGCM_sys_SendMail" 296 fi 297 IGCM_debug_PopStack "IGCM_sys_SendMail" 285 298 } 286 299 … … 291 304 #D- 292 305 function IGCM_sys_Mkdir { 293 294 295 296 297 298 299 300 301 302 303 306 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 307 if ( $DEBUG_sys ) ; then 308 echo "IGCM_sys_Mkdir :" $@ 309 fi 310 if [ ! -d ${1} ]; then 311 \mkdir -p $1 312 if [ $? -gt 0 ] ; then 313 echo "IGCM_sys_Mkdir : erreur." 314 IGCM_debug_Exit "IGCM_sys_Mkdir" 315 fi 316 fi 304 317 # vérification : 305 306 307 308 309 318 if [ ! -d ${1} ] ; then 319 echo "IGCM_sys_Mkdir : erreur." 320 IGCM_debug_Exit "IGCM_sys_Mkdir" 321 fi 322 IGCM_debug_PopStack "IGCM_sys_Mkdir" 310 323 } 311 324 … … 316 329 #D- 317 330 function IGCM_sys_MkdirArchive { 318 319 320 321 322 323 324 325 326 327 328 329 331 IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 332 if ( $DEBUG_sys ) ; then 333 echo "IGCM_sys_MkdirArchive :" $@ 334 fi 335 #- creation de repertoire sur le serveur fichier 336 rsh ${STOREHOST} -n mkdir -p $1 337 338 if [ $? -gt 0 ] ; then 339 echo "IGCM_sys_MkdirArchive : erreur." 340 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 341 fi 342 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 330 343 } 331 344 … … 336 349 #D- 337 350 function IGCM_sys_MkdirWork { 338 339 340 341 342 343 if [ ! -d ${1} ]; then344 345 346 347 348 349 350 351 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 352 if ( $DEBUG_sys ) ; then 353 echo "IGCM_sys_MkdirWork :" $@ 354 fi 355 #- creation de repertoire sur le serveur fichier 356 if [ ! -d ${1} ]; then 357 \mkdir -p $1 358 if [ $? -gt 0 ] ; then 359 echo "IGCM_sys_MkdirWork : erreur." 360 IGCM_debug_Exit "IGCM_sys_MkdirWork" 361 fi 362 fi 363 IGCM_debug_PopStack "IGCM_sys_MkdirWork" 351 364 } 352 365 … … 357 370 #D- 358 371 function IGCM_sys_Cd { 359 360 361 362 363 364 365 366 367 368 372 IGCM_debug_PushStack "IGCM_sys_Cd" $@ 373 if ( $DEBUG_sys ) ; then 374 echo "IGCM_sys_Cd :" $@ 375 fi 376 \cd $1 377 if [ $? -gt 0 ] ; then 378 echo "IGCM_sys_Cd : erreur." 379 IGCM_debug_Exit "IGCM_sys_Cd" 380 fi 381 IGCM_debug_PopStack "IGCM_sys_Cd" 369 382 } 370 383 … … 375 388 #D- 376 389 function IGCM_sys_Chmod { 377 378 379 380 381 382 383 384 385 386 387 388 389 390 390 IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 391 if ( $DEBUG_sys ) ; then 392 echo "IGCM_sys_Chmod :" $@ 393 fi 394 if [ $DRYRUN -le 1 ]; then 395 \chmod $@ 396 if [ $? -gt 0 ] ; then 397 echo "IGCM_sys_Chmod : erreur." 398 IGCM_debug_Exit "IGCM_sys_Chmod" 399 fi 400 else 401 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 402 fi 403 IGCM_debug_PopStack "IGCM_sys_Chmod" 391 404 } 392 405 … … 397 410 #D- 398 411 function IGCM_sys_FileSize { 399 400 401 402 403 404 405 406 407 408 412 IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 413 414 typeset sizeF 415 set +A sizeF -- $( ls -la ${1} ) 416 if [ $? -gt 0 ] ; then 417 IGCM_debug_Exit "IGCM_sys_FileSize" 418 fi 419 eval ${2}=${sizeF[4]} 420 421 IGCM_debug_PopStack "IGCM_sys_FileSize" 409 422 } 410 423 … … 415 428 #D- 416 429 function IGCM_sys_TestDir { 417 418 419 420 421 422 423 424 425 430 IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 431 if ( $DEBUG_sys ) ; then 432 echo "IGCM_sys_TestDir :" $@ 433 fi 434 typeset ExistFlag 435 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 436 IGCM_debug_PopStack "IGCM_sys_TestDir" 437 438 return ${ExistFlag} 426 439 } 427 440 … … 432 445 #D- 433 446 function IGCM_sys_TestDirArchive { 434 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 435 if ( $DEBUG_sys ) ; then 436 echo "IGCM_sys_TestDirArchive :" $@ 437 fi 438 typeset ExistFlag 439 ExistFlag=$( IGCM_sys_RshArchive "[ -d $1 ] && echo 0 || echo 1" ) 440 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 441 442 return ${ExistFlag} 447 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 448 if ( $DEBUG_sys ) ; then 449 echo "IGCM_sys_TestDirArchive :" $@ 450 fi 451 typeset ExistFlag 452 ExistFlag=$( IGCM_sys_RshArchive "[ -d $1 ] && echo 0 || echo 1" ) 453 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 454 455 return ${ExistFlag} 456 } 457 458 #D-#================================================== 459 #D-function IGCM_sys_IsFileArchived 460 #D-* Purpose: Test file that must NOT EXISTS on Archive 461 #D-* always true on vargas. 462 #D-* Examples: 463 #D- 464 function IGCM_sys_IsFileArchived { 465 IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@ 466 if ( $DEBUG_sys ) ; then 467 echo "IGCM_sys_IsFileArchived :" $@ 468 fi 469 typeset IsArchivedFlag 470 IsArchivedFlag=$( echo 0 ) 471 IGCM_debug_PopStack "IGCM_sys_IsFileArchived" 472 473 return ${IsArchivedFlag} 443 474 } 444 475 … … 449 480 #D- 450 481 function IGCM_sys_TestFileArchive { 451 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 452 typeset ExistFlag 453 ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" ) 454 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 455 456 return ${ExistFlag} 482 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 483 typeset ExistFlag 484 ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" ) 485 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 486 487 return ${ExistFlag} 488 } 489 490 #D-#================================================== 491 #D-function IGCM_sys_TestFileBuffer 492 #D-* Purpose: Test file that must NOT EXISTS on Buffer 493 #D-* Examples: 494 #D- 495 function IGCM_sys_TestFileBuffer { 496 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 497 typeset ExistFlag 498 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 499 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 500 501 return ${ExistFlag} 457 502 } 458 503 … … 463 508 #D- 464 509 function IGCM_sys_CountFileArchive { 465 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 466 IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 467 if [ $? -gt 0 ] ; then 468 echo "IGCM_sys_CountFileArchive : erreur." 469 fi 470 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 510 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 511 IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 512 if [ $? -gt 0 ] ; then 513 echo "IGCM_sys_CountFileArchive : erreur." 514 fi 515 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 516 } 517 518 #D-#================================================== 519 #D-function IGCM_sys_CountFileBuffer 520 #D-* Purpose: Count files on Scratch filesystem 521 #D-* Examples: 522 #D- 523 function IGCM_sys_CountFileBuffer { 524 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 525 ls ${@} 2>/dev/null | wc -l 526 if [ $? -gt 0 ] ; then 527 echo "IGCM_sys_CountFileBuffer : erreur." 528 fi 529 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 471 530 } 472 531 … … 477 536 #D- 478 537 function IGCM_sys_Tree { 479 480 481 482 483 484 485 486 538 IGCM_debug_PushStack "IGCM_sys_Tree" $@ 539 if ( $DEBUG_sys ) ; then 540 echo "IGCM_sys_Tree :" $@ 541 fi 542 543 \mfls -r $@ 544 545 IGCM_debug_PopStack "IGCM_sys_Tree" 487 546 } 488 547 … … 493 552 #D- 494 553 function IGCM_sys_Tar { 495 496 497 498 499 500 501 502 503 504 554 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 555 if ( $DEBUG_sys ) ; then 556 echo "IGCM_sys_Tar :" $@ 557 fi 558 \tar cf $@ 559 if [ $? -gt 0 ] ; then 560 echo "IGCM_sys_Tar : erreur." 561 IGCM_debug_Exit "IGCM_sys_Tar" 562 fi 563 IGCM_debug_PopStack "IGCM_sys_Tar" 505 564 } 506 565 … … 511 570 #D- 512 571 function IGCM_sys_UnTar { 513 514 515 516 517 518 519 520 521 522 572 IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 573 if ( $DEBUG_sys ) ; then 574 echo "IGCM_sys_UnTar :" $@ 575 fi 576 \tar xvf $1 577 if [ $? -gt 0 ] ; then 578 echo "IGCM_sys_UnTar : erreur." 579 IGCM_debug_Exit "IGCM_sys_UnTar" 580 fi 581 IGCM_debug_PopStack "IGCM_sys_UnTar" 523 582 } 524 583 … … 529 588 #D- 530 589 function IGCM_sys_Qsub { 531 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 532 if ( $DEBUG_sys ) ; then 533 echo "IGCM_sys_Qsub :" $@ 534 fi 535 # We have to change output/error file 536 [ ${#@} = 1 ] && REP_FOR_JOB=$LOADL_STEP_INITDIR 537 [ ${#@} = 2 ] && REP_FOR_JOB=$2 538 sed -e "s/\# \@ output *= .*/\# \@ output = ${Script_Output}/" -e "s/\# \@ error *= .*/\# \@ error = ${Script_Output}/" <$1 >${REP_FOR_JOB}/JOB_FOR_IGCM 539 { 540 [ ${#@} = 1 ] && ( cd $LOADL_STEP_INITDIR ; /usr/local/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; ) 541 [ ${#@} = 2 ] && ( cd $2 ; /usr/local/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; ) 542 } 543 if [ ${ERROR} -gt 0 ] ; then 544 echo "IGCM_sys_Qsub : erreur $@." 545 IGCM_debug_Exit "IGCM_sys_Qsub" 546 fi 547 IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM 548 IGCM_debug_PopStack "IGCM_sys_Qsub" 590 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 591 592 typeset ERROR 593 ERROR=0 594 595 if ( $DEBUG_sys ) ; then 596 echo "IGCM_sys_Qsub :" $@ 597 fi 598 # We have to change output/error file 599 [ ${#@} = 1 ] && REP_FOR_JOB=$LOADL_STEP_INITDIR 600 [ ${#@} = 2 ] && REP_FOR_JOB=$2 601 sed -e "s/\# \@ output *= .*/\# \@ output = ${Script_Output}/" -e "s/\# \@ error *= .*/\# \@ error = ${Script_Output}/" <$1 >${REP_FOR_JOB}/JOB_FOR_IGCM 602 { 603 [ ${#@} = 1 ] && ( cd $LOADL_STEP_INITDIR ; /usr/local/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; ) 604 [ ${#@} = 2 ] && ( cd $2 ; /usr/local/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; ) 605 } 606 if [ ${ERROR} -gt 0 ] ; then 607 echo "IGCM_sys_Qsub : erreur $@." 608 IGCM_debug_Exit "IGCM_sys_Qsub" 609 fi 610 IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM 611 IGCM_debug_PopStack "IGCM_sys_Qsub" 549 612 550 613 } … … 556 619 #D- 557 620 function IGCM_sys_QsubPost { 558 559 560 561 562 563 564 565 566 567 568 569 621 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 622 if ( $DEBUG_sys ) ; then 623 echo "IGCM_sys_QsubPost :" $@ 624 fi 625 cd ${POST_DIR} 626 /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM_POST}/$1.job 627 cd - 628 if [ $? -gt 0 ] ; then 629 echo "IGCM_sys_QsubPost : erreur " $@ 630 IGCM_debug_Exit "IGCM_sys_QsubPost" 631 fi 632 IGCM_debug_PopStack "IGCM_sys_QsubPost" 570 633 } 571 634 572 635 #D-************************* 573 #D- File transfer functions 636 #D- File transfer functions 574 637 #D-************************* 575 638 #D- … … 581 644 #D- Error values and explanations can depend on your system version. 582 645 function IGCM_sys_Rsync_out { 583 RET=$1 584 if [ ! $RET ] ; then 585 echo "rsync error !" 586 fi 587 588 if [ $MYLANG = "fr" ]; then 589 case $RET in 590 0) return ;; 591 1) echo "Erreur de rsync ; RERR_SYNTAX : " 592 echo "Erreur de syntaxe ou d'utilisation." 593 return;; 594 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 595 echo "Incompatibilité de protocole." 596 return;; 597 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 598 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 599 echo "répertoires" 600 return;; 601 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 602 echo "Action demandée non supportée : une tentative de manipulation de" 603 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 604 echo "été faite ; ou une option qui est supportée par le client mais" 605 echo "pas par le serveur a été spécifiée." 606 return;; 607 10) echo "Erreur de rsync ; RERR_SOCKETIO" 608 echo "Erreur dans le socket d'entrée sortie" 609 return;; 610 11) echo "Erreur de rsync ; RERR_FILEIO" 611 echo "Erreur d'entrée sortie fichier" 612 return;; 613 12) echo "Erreur de rsync ; RERR_STREAMIO" 614 echo "Erreur dans flux de donnée du protocole rsync" 615 return;; 616 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 617 echo "Erreur avec les diagnostics du programme" 618 return;; 619 14) echo "Erreur de rsync ; RERR_IPC" 620 echo "Erreur dans le code IPC" 621 return;; 622 20) echo "Erreur de rsync ; RERR_SIGNAL" 623 echo "SIGUSR1 ou SIGINT reçu" 624 return;; 625 21) echo "Erreur de rsync ; RERR_WAITCHILD" 626 echo "Une erreur retournée par waitpid()" 627 return;; 628 22) echo "Erreur de rsync ; RERR_MALLOC" 629 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 630 return;; 631 23) echo "" 632 echo "Erreur fichier inexistant" 633 return;; 634 30) echo "Erreur de rsync ; RERR_TIMEOUT" 635 echo "Temps d'attente écoulé dans l'envoi/réception de données" 636 return;; 637 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 638 return;; 639 esac 640 elif [ $MYLANG = "en" ] ; then 641 case $RET in 642 0) return;; 643 1) echo "rsync error : Syntax or usage error " 644 return;; 645 2) echo "rsync error : Protocol incompatibility " 646 return;; 647 3) echo "rsync error : Errors selecting input/output files, dirs" 648 return;; 649 4) echo "rsync error : Requested action not supported: an attempt" 650 echo "was made to manipulate 64-bit files on a platform that cannot support" 651 echo "them; or an option was specified that is supported by the client and" 652 echo "not by the server." 653 return;; 654 5) echo "rsync error : Error starting client-server protocol" 655 return;; 656 10) echo "rsync error : Error in socket I/O " 657 return;; 658 11) echo "rsync error : Error in file I/O " 659 return;; 660 12) echo "rsync error : Error in rsync protocol data stream " 661 return;; 662 13) echo "rsync error : Errors with program diagnostics " 663 return;; 664 14) echo "rsync error : Error in IPC code " 665 return;; 666 20) echo "rsync error : Received SIGUSR1 or SIGINT " 667 return;; 668 21) echo "rsync error : Some error returned by waitpid() " 669 return;; 670 22) echo "rsync error : Error allocating core memory buffers " 671 return;; 672 23) echo "rsync error : Partial transfer due to error" 673 return;; 674 24) echo "rsync error : Partial transfer due to vanished source files" 675 return;; 676 30) echo "rsync error : Timeout in data send/receive " 677 return;; 678 *) echo "rsync error : return code of rsync unknown :" $RET 679 return;; 680 esac 681 else 682 echo "unknown language $MYLANG." 683 return 684 fi 685 } 686 646 RET=$1 647 if [ ! $RET ] ; then 648 echo "rsync error !" 649 fi 650 651 if [ $MYLANG = "fr" ]; then 652 case $RET in 653 0) return ;; 654 1) echo "Erreur de rsync ; RERR_SYNTAX : " 655 echo "Erreur de syntaxe ou d'utilisation." 656 return;; 657 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 658 echo "Incompatibilité de protocole." 659 return;; 660 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 661 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 662 echo "répertoires" 663 return;; 664 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 665 echo "Action demandée non supportée : une tentative de manipulation de" 666 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 667 echo "été faite ; ou une option qui est supportée par le client mais" 668 echo "pas par le serveur a été spécifiée." 669 return;; 670 10) echo "Erreur de rsync ; RERR_SOCKETIO" 671 echo "Erreur dans le socket d'entrée sortie" 672 return;; 673 11) echo "Erreur de rsync ; RERR_FILEIO" 674 echo "Erreur d'entrée sortie fichier" 675 return;; 676 12) echo "Erreur de rsync ; RERR_STREAMIO" 677 echo "Erreur dans flux de donnée du protocole rsync" 678 return;; 679 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 680 echo "Erreur avec les diagnostics du programme" 681 return;; 682 14) echo "Erreur de rsync ; RERR_IPC" 683 echo "Erreur dans le code IPC" 684 return;; 685 20) echo "Erreur de rsync ; RERR_SIGNAL" 686 echo "SIGUSR1 ou SIGINT reçu" 687 return;; 688 21) echo "Erreur de rsync ; RERR_WAITCHILD" 689 echo "Une erreur retournée par waitpid()" 690 return;; 691 22) echo "Erreur de rsync ; RERR_MALLOC" 692 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 693 return;; 694 23) echo "" 695 echo "Erreur fichier inexistant" 696 return;; 697 30) echo "Erreur de rsync ; RERR_TIMEOUT" 698 echo "Temps d'attente écoulé dans l'envoi/réception de données" 699 return;; 700 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 701 return;; 702 esac 703 elif [ $MYLANG = "en" ] ; then 704 case $RET in 705 0) return;; 706 1) echo "rsync error : Syntax or usage error " 707 return;; 708 2) echo "rsync error : Protocol incompatibility " 709 return;; 710 3) echo "rsync error : Errors selecting input/output files, dirs" 711 return;; 712 4) echo "rsync error : Requested action not supported: an attempt" 713 echo "was made to manipulate 64-bit files on a platform that cannot support" 714 echo "them; or an option was specified that is supported by the client and" 715 echo "not by the server." 716 return;; 717 5) echo "rsync error : Error starting client-server protocol" 718 return;; 719 10) echo "rsync error : Error in socket I/O " 720 return;; 721 11) echo "rsync error : Error in file I/O " 722 return;; 723 12) echo "rsync error : Error in rsync protocol data stream " 724 return;; 725 13) echo "rsync error : Errors with program diagnostics " 726 return;; 727 14) echo "rsync error : Error in IPC code " 728 return;; 729 20) echo "rsync error : Received SIGUSR1 or SIGINT " 730 return;; 731 21) echo "rsync error : Some error returned by waitpid() " 732 return;; 733 22) echo "rsync error : Error allocating core memory buffers " 734 return;; 735 23) echo "rsync error : Partial transfer due to error" 736 return;; 737 24) echo "rsync error : Partial transfer due to vanished source files" 738 return;; 739 30) echo "rsync error : Timeout in data send/receive " 740 return;; 741 *) echo "rsync error : return code of rsync unknown :" $RET 742 return;; 743 esac 744 else 745 echo "unknown language $MYLANG." 746 return 747 fi 748 } 687 749 688 750 #D-#================================================== … … 692 754 #D- 693 755 function IGCM_sys_Mirror_libIGCM { 694 695 696 697 698 699 700 701 756 IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 757 if ( $DEBUG_sys ) ; then 758 echo "IGCM_sys_Mirror_libIGCM" 759 fi 760 761 typeset RET 762 763 IGCM_sys_RshPost <<-EOF 702 764 mkdir -p ${HOME_POST}/MIRROR/${PATHlibIGCM} 703 765 EOF 704 rsh ulam -n hostname > /dev/null 2>&1 766 rsh ulam -n hostname > /dev/null 2>&1 767 RET=$? 768 if [ $RET -eq 0 ] ; then 769 echo ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 770 ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 705 771 RET=$? 706 if [ $RET -eq 0 ] ; then 707 echo ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 708 ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 709 RET=$? 710 711 if [ ${RET} -gt 0 ] ; then 712 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on ulam." 713 cat out_rsync 714 fi 715 else 716 echo "No POST-TREATMENT avaible because ulam is down." 717 fi 718 IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 772 773 if [ ${RET} -gt 0 ] ; then 774 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on ulam." 775 cat out_rsync 776 fi 777 IGCM_sys_Rm out_rsync 778 else 779 echo "No POST-TREATMENT avaible because ulam is down." 780 fi 781 IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 719 782 } 720 783 … … 722 785 #- Call IGCM_sys_Mirror_libIGCM now ! 723 786 if ( $MirrorlibIGCM ) ; then 724 787 IGCM_sys_Mirror_libIGCM 725 788 fi 726 789 … … 731 794 #D- 732 795 function IGCM_sys_Cp { 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 796 IGCM_debug_PushStack "IGCM_sys_Cp" $@ 797 if ( $DEBUG_sys ) ; then 798 echo "IGCM_sys_Cp :" $@ 799 fi 800 801 typeset RET 802 803 echo cp $@ > out_rsync 2>&1 804 \cp $@ >> out_rsync 2>&1 805 RET=$? 806 807 if [ ${RET} -gt 0 ] ; then 808 echo "IGCM_sys_Cp : error." 809 cat out_rsync 810 IGCM_debug_Exit "IGCM_sys_Cp" 811 else 812 \rm out_rsync 813 fi 814 IGCM_debug_PopStack "IGCM_sys_Cp" 752 815 } 753 816 … … 758 821 #D- 759 822 function IGCM_sys_Rm { 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 823 IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 824 if ( $DEBUG_sys ) ; then 825 echo "IGCM_sys_Rm :" $@ 826 fi 827 828 typeset RET 829 830 echo rm $@ > out_rsync 2>&1 831 \rm $@ >> out_rsync 2>&1 832 RET=$? 833 834 if [ ${RET} -gt 0 ] ; then 835 echo "IGCM_sys_Rm : error." 836 cat out_rsync 837 IGCM_debug_Exit "IGCM_sys_Rm" 838 else 839 \rm out_rsync 840 fi 841 IGCM_debug_PopStack "IGCM_sys_Rm" 779 842 } 780 843 … … 786 849 #D- 787 850 function IGCM_sys_RmRunDir { 788 789 790 791 792 793 851 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 852 if ( $DEBUG_sys ) ; then 853 echo "IGCM_sys_RmRunDir :" $@ 854 echo "Dummy call, let the scheduler do that." 855 fi 856 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 794 857 } 795 858 … … 800 863 #D- 801 864 function IGCM_sys_Mv { 802 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 803 if ( $DEBUG_sys ) ; then 804 echo "IGCM_sys_Mv :" $@ 805 fi 806 807 if [ $DRYRUN = 0 ]; then 808 809 typeset RET 810 811 echo mv $@ > out_rsync 2>&1 812 \mv $@ >> out_rsync 2>&1 813 RET=$? 814 815 if [ ${RET} -gt 0 ] ; then 816 echo "IGCM_sys_Mv : error in mv." 817 cat out_rsync 818 IGCM_debug_Exit "IGCM_sys_Mv" 819 else 820 \rm out_rsync 821 fi 865 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 866 if ( $DEBUG_sys ) ; then 867 echo "IGCM_sys_Mv :" $@ 868 fi 869 870 if [ $DRYRUN = 0 ]; then 871 872 typeset RET 873 874 echo mv $@ > out_rsync 2>&1 875 \mv $@ >> out_rsync 2>&1 876 RET=$? 877 878 if [ ${RET} -gt 0 ] ; then 879 echo "IGCM_sys_Mv : error in mv." 880 cat out_rsync 881 IGCM_debug_Exit "IGCM_sys_Mv" 822 882 else 823 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 824 fi 825 826 IGCM_debug_PopStack "IGCM_sys_Mv" 883 \rm out_rsync 884 fi 885 else 886 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 887 fi 888 889 IGCM_debug_PopStack "IGCM_sys_Mv" 827 890 } 828 891 … … 833 896 #D- 834 897 function IGCM_sys_Put_Dir { 835 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 836 if ( $DEBUG_sys ) ; then 837 echo "IGCM_sys_Put_Dir :" $@ 838 fi 839 if [ $DRYRUN = 0 ]; then 840 if [ ! -d ${1} ] ; then 841 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 842 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 843 return 844 fi 845 846 typeset RET 847 848 # Only if we use rsync 849 #IGCM_sys_TestDirArchive $( dirname $2 ) 850 # 851 #USUAL WAY 852 rcp -r $1 ${STOREHOST}:$2 > out_rsync 2>&1 853 RET=$? 854 855 if [ ${RET} -gt 0 ] ; then 856 echo "IGCM_sys_Put_Dir : error." 857 cat out_rsync 858 IGCM_debug_Exit "IGCM_sys_Put_Dir" 859 else 860 \rm out_rsync 861 fi 898 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 899 if ( $DEBUG_sys ) ; then 900 echo "IGCM_sys_Put_Dir :" $@ 901 fi 902 if [ $DRYRUN = 0 ]; then 903 if [ ! -d ${1} ] ; then 904 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 905 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 906 return 907 fi 908 909 typeset RET 910 911 # Only if we use rsync 912 #IGCM_sys_TestDirArchive $( dirname $2 ) 913 # 914 #USUAL WAY 915 rcp -r $1 ${STOREHOST}:$2 > out_rsync 2>&1 916 RET=$? 917 918 if [ ${RET} -gt 0 ] ; then 919 echo "IGCM_sys_Put_Dir : error." 920 cat out_rsync 921 IGCM_debug_Exit "IGCM_sys_Put_Dir" 862 922 else 863 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 864 fi 865 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 923 \rm out_rsync 924 fi 925 else 926 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 927 fi 928 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 866 929 } 867 930 … … 872 935 #D- 873 936 function IGCM_sys_Get_Dir { 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 937 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 938 if ( $DEBUG_sys ) ; then 939 echo "IGCM_sys_Get_Dir :" $@ 940 fi 941 if [ $DRYRUN = 0 ]; then 942 if [ ! -d ${1} ] ; then 943 echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 944 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 945 return 946 fi 947 948 typeset RET 949 950 #USUAL WAY 951 rcp -rp ${STOREHOST}:$1 $2 > out_rsync 2>&1 952 RET=$? 953 954 if [ ${RET} -gt 0 ] ; then 955 echo "IGCM_sys_Get_Dir : error." 956 cat out_rsync 957 IGCM_debug_Exit "IGCM_sys_Get_Dir" 958 fi 959 else 960 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 961 fi 962 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 900 963 } 901 964 … … 907 970 #D- 908 971 function IGCM_sys_Put_Rest { 909 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 910 if ( $DEBUG_sys ) ; then 911 echo "IGCM_sys_Put_Rest :" $@ 912 fi 913 if [ $DRYRUN = 0 ]; then 914 if [ ! -f ${1} ] ; then 915 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 916 IGCM_debug_Exit "IGCM_sys_Put_Rest" 917 fi 918 919 typeset RET 920 # 921 if [ X${JobType} = XRUN ] ; then 922 IGCM_sys_Chmod 444 ${1} 923 fi 924 # 925 # Only if we use rsync 926 #IGCM_sys_MkdirArchive $( dirname $2 ) 927 # 928 #USUAL WAY 929 mfput $1 $2 > out_rsync 2>&1 930 RET=$? 931 932 # #RSYNC WITH NETWORK RSH CALL 933 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 934 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 935 936 # #RSYNC WITH NFS USE 937 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 938 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 939 940 # RET=$? 941 # IGCM_sys_Rsync_out $RET 942 943 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 944 # (( RET=RET+$? )) 945 946 if [ ${RET} -gt 0 ] ; then 947 echo "IGCM_sys_Put_Rest : error." 948 cat out_rsync 949 IGCM_debug_Exit "IGCM_sys_Put_Rest" 950 else 951 \rm out_rsync 952 fi 972 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 973 if ( $DEBUG_sys ) ; then 974 echo "IGCM_sys_Put_Rest :" $@ 975 fi 976 if [ $DRYRUN = 0 ]; then 977 if [ ! -f ${1} ] ; then 978 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 979 IGCM_debug_Exit "IGCM_sys_Put_Rest" 980 fi 981 982 typeset RET 983 # 984 if [ X${JobType} = XRUN ] ; then 985 IGCM_sys_Chmod 444 ${1} 986 fi 987 # 988 # Only if we use rsync 989 #IGCM_sys_MkdirArchive $( dirname $2 ) 990 # 991 #USUAL WAY 992 mfput $1 $2 > out_rsync 2>&1 993 RET=$? 994 995 # #RSYNC WITH NETWORK RSH CALL 996 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 997 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 998 999 # #RSYNC WITH NFS USE 1000 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1001 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1002 1003 # RET=$? 1004 # IGCM_sys_Rsync_out $RET 1005 1006 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1007 # (( RET=RET+$? )) 1008 1009 if [ ${RET} -gt 0 ] ; then 1010 echo "IGCM_sys_Put_Rest : error." 1011 cat out_rsync 1012 IGCM_debug_Exit "IGCM_sys_Put_Rest" 953 1013 else 954 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 955 fi 956 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 1014 \rm out_rsync 1015 fi 1016 else 1017 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1018 fi 1019 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 1020 } 1021 1022 #D-#================================================== 1023 #D-function IGCM_sys_PutBuffer_Rest 1024 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 1025 #D- File and target directory must exist. 1026 #D-* Examples: 1027 #D- 1028 function IGCM_sys_PutBuffer_Rest { 1029 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 1030 if ( $DEBUG_sys ) ; then 1031 echo "IGCM_sys_PutBuffer_Rest :" $@ 1032 fi 1033 if [ $DRYRUN = 0 ]; then 1034 if [ ! -f ${1} ] ; then 1035 echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 1036 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1037 fi 1038 1039 typeset RET 1040 # 1041 if [ X${JobType} = XRUN ] ; then 1042 IGCM_sys_Chmod 444 ${1} 1043 fi 1044 1045 # 1046 # USUAL WAY 1047 \cp $1 $2 > out_rsync 2>&1 1048 RET=$? 1049 1050 if [ ${RET} -gt 0 ] ; then 1051 echo "IGCM_sys_PutBuffer_Rest : error." 1052 cat out_rsync 1053 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1054 else 1055 \rm out_rsync 1056 fi 1057 else 1058 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1059 fi 1060 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 957 1061 } 958 1062 … … 963 1067 #D- 964 1068 function IGCM_sys_Put_Out { 965 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 966 if ( $DEBUG_sys ) ; then 967 echo "IGCM_sys_Put_Out :" $@ 968 fi 969 if [ $DRYRUN = 0 ]; then 970 if [ ! -f ${1} ] ; then 971 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 972 IGCM_debug_PopStack "IGCM_sys_Put_Out" 973 return 1 974 fi 975 976 typeset RET 977 # 978 if [ X${JobType} = XRUN ] ; then 979 if [ X${3} = X ] ; then 980 IGCM_sys_Chmod 444 ${1} 981 fi 982 fi 983 # 984 # Only if we use rsync 985 #IGCM_sys_MkdirArchive $( dirname $2 ) 986 # 987 #USUAL WAY 988 mfput $1 $2 > out_rsync 2>&1 989 RET=$? 990 991 # #RSYNC WITH NETWORK RSH CALL 992 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 993 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 994 995 # #RSYNC WITH NFS USE 996 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 997 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 998 999 # RET=$? 1000 # IGCM_sys_Rsync_out $RET 1001 1002 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1003 # (( RET=RET+$? )) 1004 1005 if [ ${RET} -gt 0 ] ; then 1006 echo "IGCM_sys_Put_Out : error." 1007 cat out_rsync 1008 IGCM_debug_Exit "IGCM_sys_Put_Out" 1009 else 1010 \rm out_rsync 1011 fi 1069 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 1070 if ( $DEBUG_sys ) ; then 1071 echo "IGCM_sys_Put_Out :" $@ 1072 fi 1073 if [ $DRYRUN = 0 ]; then 1074 if [ ! -f ${1} ] ; then 1075 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 1076 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1077 return 1 1078 fi 1079 1080 typeset RET 1081 # 1082 if [ X${JobType} = XRUN ] ; then 1083 if [ X${3} = X ] ; then 1084 IGCM_sys_Chmod 444 ${1} 1085 fi 1086 fi 1087 # 1088 # Only if we use rsync 1089 #IGCM_sys_MkdirArchive $( dirname $2 ) 1090 # 1091 #USUAL WAY 1092 mfput $1 $2 > out_rsync 2>&1 1093 RET=$? 1094 1095 # #RSYNC WITH NETWORK RSH CALL 1096 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1097 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 1098 1099 # #RSYNC WITH NFS USE 1100 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1101 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1102 1103 # RET=$? 1104 # IGCM_sys_Rsync_out $RET 1105 1106 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1107 # (( RET=RET+$? )) 1108 1109 if [ ${RET} -gt 0 ] ; then 1110 echo "IGCM_sys_Put_Out : error." 1111 cat out_rsync 1112 IGCM_debug_Exit "IGCM_sys_Put_Out" 1012 1113 else 1013 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1014 fi 1015 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1016 return 0 1114 \rm out_rsync 1115 fi 1116 IGCM_sys_Rm out_rsync 1117 else 1118 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1119 fi 1120 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1121 return 0 1122 } 1123 1124 #D-#================================================== 1125 #D-function IGCM_sys_PutBuffer_Out 1126 #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly 1127 #D-* Examples: 1128 #D- 1129 function IGCM_sys_PutBuffer_Out { 1130 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 1131 if ( $DEBUG_sys ) ; then 1132 echo "IGCM_sys_PutBuffer_Out :" $@ 1133 fi 1134 if [ $DRYRUN = 0 ]; then 1135 if [ ! -f ${1} ] ; then 1136 echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 1137 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1138 return 1 1139 fi 1140 # 1141 IGCM_sys_Mkdir $( dirname $2 ) 1142 # 1143 typeset RET 1144 1145 if [ X${JobType} = XRUN ] ; then 1146 if [ X${3} = X ] ; then 1147 IGCM_sys_Chmod 444 ${1} 1148 fi 1149 fi 1150 # 1151 # USUAL WAY 1152 \cp $1 $2 > out_rsync 2>&1 1153 RET=$? 1154 1155 if [ ${RET} -gt 0 ] ; then 1156 echo "IGCM_sys_PutBuffer_Out : error." 1157 cat out_rsync 1158 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 1159 else 1160 \rm out_rsync 1161 fi 1162 else 1163 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1164 fi 1165 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1166 return 0 1017 1167 } 1018 1168 … … 1023 1173 #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ 1024 1174 function IGCM_sys_Get { 1025 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1026 1027 typeset DEST RET dm_liste ifile target 1028 1029 if ( $DEBUG_sys ) ; then 1030 echo "IGCM_sys_Get :" $@ 1031 fi 1032 if [ $DRYRUN -le 2 ]; then 1033 if [ X${1} = X'/l' ] ; then 1034 # test if the first file is present in the old computation : 1035 eval set +A dm_liste \${${2}} 1036 else 1037 dm_liste=${1} 1038 fi 1039 eval DEST=\${${#}} 1040 1041 # test if the (first) file is present in the old computation : 1042 IGCM_sys_TestFileArchive ${dm_liste[0]} 1043 RET=$? 1044 if [ ${RET} -gt 0 ] ; then 1045 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1046 IGCM_debug_Exit "IGCM_sys_Get" 1047 return 1048 fi 1049 1050 # SD : dm_liste is not suited for computing job 1051 # because we change filename during transfert 1052 # dm_liste is better suited for post-treatment 1053 #dm_liste=" " 1054 #(( ifile=1 )) 1055 #while [ $ifile -lt $# ] ; do 1056 # dm_liste=$( eval echo ${dm_liste} " "\${${ifile}} ) 1057 # (( ifile = ifile + 1 )) 1058 #done 1059 #DEST=$( eval echo \${${#}} ) 1060 1061 #USUAL WAY 1062 mfget ${dm_liste[*]} ${DEST} > out_rsync 2>&1 1063 #mfget $1 $2 > out_rsync 2>&1 1064 RET=$? 1065 1066 # #RSYNC WITH NETWORK RSH CALL 1067 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 1068 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 1069 1070 # #RSYNC WITH NFS USE 1071 # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 1072 # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 1073 1074 # RET=$? 1075 # IGCM_sys_Rsync_out $RET 1076 1077 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1078 # (( RET=RET+$? )) 1079 1080 if [ ${RET} -gt 0 ] ; then 1081 echo "IGCM_sys_Get : copy error." 1082 cat out_rsync 1083 IGCM_debug_Exit "IGCM_sys_Get" 1084 else 1085 \rm out_rsync 1086 fi 1175 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1176 1177 typeset DEST RET dm_liste ifile target 1178 1179 if ( $DEBUG_sys ) ; then 1180 echo "IGCM_sys_Get :" $@ 1181 fi 1182 if [ $DRYRUN -le 2 ]; then 1183 if [ X${1} = X'/l' ] ; then 1184 # test if the first file is present in the old computation : 1185 eval set +A dm_liste \${${2}} 1087 1186 else 1088 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1089 fi 1090 IGCM_debug_PopStack "IGCM_sys_Get" 1187 dm_liste=${1} 1188 fi 1189 eval DEST=\${${#}} 1190 1191 # test if the (first) file is present in the old computation : 1192 IGCM_sys_TestFileArchive ${dm_liste[0]} 1193 RET=$? 1194 if [ ${RET} -gt 0 ] ; then 1195 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1196 IGCM_debug_Exit "IGCM_sys_Get" 1197 return 1198 fi 1199 1200 # SD : dm_liste is not suited for computing job 1201 # because we change filename during transfert 1202 # dm_liste is better suited for post-treatment 1203 #dm_liste=" " 1204 #(( ifile=1 )) 1205 #while [ $ifile -lt $# ] ; do 1206 # dm_liste=$( eval echo ${dm_liste} " "\${${ifile}} ) 1207 # (( ifile = ifile + 1 )) 1208 #done 1209 #DEST=$( eval echo \${${#}} ) 1210 1211 #USUAL WAY 1212 mfget ${dm_liste[*]} ${DEST} > out_rsync 2>&1 1213 RET=$? 1214 1215 # #RSYNC WITH NETWORK RSH CALL 1216 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 1217 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 1218 1219 # #RSYNC WITH NFS USE 1220 # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 1221 # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 1222 1223 # RET=$? 1224 # IGCM_sys_Rsync_out $RET 1225 1226 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1227 # (( RET=RET+$? )) 1228 1229 if [ ${RET} -gt 0 ] ; then 1230 echo "IGCM_sys_Get : copy error." 1231 cat out_rsync 1232 IGCM_debug_Exit "IGCM_sys_Get" 1233 else 1234 \rm out_rsync 1235 fi 1236 else 1237 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1238 fi 1239 IGCM_debug_PopStack "IGCM_sys_Get" 1240 } 1241 1242 #D-#================================================== 1243 #D-function IGCM_sys_GetBuffer 1244 #D-* Purpose: Get a file from ${SCRATCHDIR} 1245 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 1246 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 1247 function IGCM_sys_GetBuffer { 1248 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1249 1250 typeset DEST RET buf_liste ifile target file_work 1251 1252 if ( $DEBUG_sys ) ; then 1253 echo "IGCM_sys_GetBuffer :" $@ 1254 fi 1255 if [ $DRYRUN -le 2 ]; then 1256 if [ X${1} = X'/l' ] ; then 1257 # test if the first file is present in the old computation : 1258 eval set +A buf_liste \${${2}} 1259 else 1260 eval set +A buf_liste ${1} 1261 fi 1262 eval DEST=\${${#}} 1263 1264 #USUAL WAY 1265 if [ X${1} = X'/l' ] ; then 1266 (( RET=0 )) 1267 for target in ${buf_liste[*]} ; do 1268 local_file=$( basename ${target} ) 1269 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1270 (( RET = RET + $? )) 1271 done 1272 else 1273 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1274 RET=$? 1275 fi 1276 1277 if [ ${RET} -gt 0 ] ; then 1278 echo "IGCM_sys_GetBuffer : copy error." 1279 cat out_rsync 1280 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1281 else 1282 \rm out_rsync 1283 fi 1284 else 1285 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1286 fi 1287 IGCM_debug_PopStack "IGCM_sys_GetBuffer" 1091 1288 } 1092 1289 … … 1099 1296 #D- 1100 1297 function IGCM_sys_GetDate_FichWork { 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1298 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1299 if ( $DEBUG_sys ) ; then 1300 echo "IGCM_sys_GetDate_FichWork :" $@ 1301 fi 1302 typeset dateF 1303 set +A dateF -- $( rsh ${MASTER} -n /opt/freeware/bin/ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1304 eval ${2}=${dateF[5]} 1305 1306 # donne la date filesys d'un fichier sur la machine work 1307 IGCM_debug_PopStack "IGCM_sys_FichWork" 1111 1308 } 1112 1309 1113 1310 #D-#================================================== 1114 1311 #D-function IGCM_sys_GetDate_FichArchive 1115 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1312 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1116 1313 #D-* Examples: 1117 1314 #D- 1118 1315 function IGCM_sys_GetDate_FichArchive { 1119 1120 1121 1122 1123 1124 1125 1126 1127 1316 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1317 if ( $DEBUG_sys ) ; then 1318 echo "IGCM_sys_GetDate_FichArchive :" $@ 1319 fi 1320 typeset dateF 1321 set +A dateF -- $( rsh ${STOREHOST} -n ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1322 eval ${2}=${dateF[5]} 1323 1324 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1128 1325 } 1129 1326 … … 1132 1329 1133 1330 function IGCM_sys_rebuild { 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1331 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1332 if ( $DEBUG_sys ) ; then 1333 echo "IGCM_sys_rebuild :" $@ 1334 fi 1335 /homegpfs/rech/psl/rpsl035/bin/rebuild -f -o $@ 1336 if [ $? -gt 0 ] ; then 1337 echo "IGCM_sys_rebuild : erreur ${@}." 1338 IGCM_debug_Exit "rebuild" 1339 fi 1340 1341 IGCM_debug_PopStack "IGCM_sys_rebuild" 1145 1342 } 1146 1343 … … 1149 1346 1150 1347 function IGCM_sys_activ_variables { 1151 1152 1153 1154 1348 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1349 if ( $DEBUG_sys ) ; then 1350 echo "IGCM_sys_activ_variables " 1351 fi 1155 1352 1156 1353 # -------------------------------------------------------------------- … … 1162 1359 # -------------------------------------------------------------------- 1163 1360 1164 1361 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1165 1362 1166 1363 } … … 1170 1367 1171 1368 function IGCM_sys_desactiv_variables { 1172 1173 1174 1175 1369 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1370 if ( $DEBUG_sys ) ; then 1371 echo "IGCM_sys_desactiv_variables " 1372 fi 1176 1373 # -------------------------------------------------------------------- 1177 1374 #D- MPI specifications … … 1182 1379 # -------------------------------------------------------------------- 1183 1380 1184 1185 1381 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1382 1186 1383 } 1187 1384 1188 1385 ############################################################ 1189 # Build run file 1386 # Build MPI/OMP scripts 1387 function IGCM_sys_build_execution_scripts 1388 { 1389 IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ 1390 if ( $DEBUG_sys ) ; then 1391 echo "IGCM_sys_build_execution_scripts " $@ 1392 fi 1393 1394 typeset NbNodes_Job NbProc_Job comp_proc_mpi_loc comp_proc_omp_loc mpi_count 1395 1396 if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ] ; then 1397 IGCM_debug_Exit "IGCM_sys_vargas build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 1398 fi 1399 1400 if ( ${OK_PARA_MPMD} ) ; then 1401 1402 if [ -f run_file ] ; then 1403 IGCM_sys_Rm -f run_file 1404 fi 1405 touch run_file 1406 1407 if ( ${OK_PARA_OMP} ) ; then 1408 # NEW : 2 Noeuds 1409 # @ task_geometry={(0)(1,2,3)} 1410 # Nombre de processus demandes 1411 echo "Job_${config_UserChoices_JobName} includes task_geometry = \c" 1412 cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" 1413 echo "Job_${config_UserChoices_JobName} includes task_geometry with NbNodes = \c" 1414 cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" | wc -c 1415 NbNodes_Job=$(( $( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" | wc -c ) - 1 )) 1416 1417 if [ ${NbNodes_Job} -eq 0 ] ; then 1418 IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources : no task_geometry defined with OpenMP run." 1419 exit 1 1420 fi 1421 else 1422 1423 # OLD : 1424 # @ total_tasks = 3 1425 # @ environment = "BATCH_NUM_PROC_TOT=3" 1426 # Pas d OpenMP 1427 # @ resources = ConsumableCpus(1) 1428 1429 echo "Job_${config_UserChoices_JobName} includes total_tasks = \c" 1430 cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "total_tasks" | sed -e "s/.*total_tasks = //" 1431 NbProc_Job=$( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "total_tasks" | sed -e "s/.*total_tasks = //" ) 1432 NbProc_Job=${NbProc_Job:=0} 1433 if [ ${NbProc_Job} -eq 0 ] ; then 1434 IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources : no total_tasks defined with MPI only run." 1435 exit 1 1436 fi 1437 if ( $( egrep '^# *@ *resources *= *ConsumableCpus\(1\)' ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} >/dev/null 2>&1 ) ) ; then 1438 IGCM_debug_Print 2 "ressources = ConsumableCpus(1) line found into Job_${config_UserChoices_JobName}" 1439 else 1440 IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources = line not found. Job should include resources = ConsumableCpus(1) " 1441 exit 1 1442 fi 1443 fi 1444 1445 # run_file construction 1446 1447 # Then first loop on the components for the coupler ie oasis 1448 1449 ### the coupler ie oasis must be the first one 1450 for comp in ${config_ListOfComponents[*]} ; do 1451 1452 eval ExeNameIn=\${config_Executable_${comp}[0]} 1453 eval ExeNameOut=\${config_Executable_${comp}[1]} 1454 1455 # for CPL component only 1456 if [ "X${comp}" = "XCPL" ] ; then 1457 1458 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1459 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 1460 1461 if ( ${OK_PARA_MPI} ) ; then 1462 1463 (( mpi_count = 1 )) 1464 until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 1465 if ( ${OK_PARA_OMP} ) ; then 1466 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 1467 else 1468 echo "./${ExeNameOut}" >> run_file 1469 fi 1470 (( mpi_count = mpi_count + 1 )) 1471 done 1472 else 1473 if ( ${OK_PARA_OMP} ) ; then 1474 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 1475 else 1476 echo "./${ExeNameOut} " >> run_file 1477 fi 1478 fi 1479 fi 1480 done 1481 1482 # Then second loop on the components 1483 1484 for comp in ${config_ListOfComponents[*]} ; do 1485 1486 eval ExeNameIn=\${config_Executable_${comp}[0]} 1487 eval ExeNameOut=\${config_Executable_${comp}[1]} 1488 1489 # Only if we really have an executable for the component and not the coupler ie oasis: 1490 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 1491 1492 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1493 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 1494 1495 if ( ${OK_PARA_MPI} ) ; then 1496 1497 (( mpi_count = 1 )) 1498 until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 1499 if ( ${OK_PARA_OMP} ) ; then 1500 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 1501 else 1502 echo "./${ExeNameOut}" >> run_file 1503 fi 1504 (( mpi_count = mpi_count + 1 )) 1505 done 1506 else 1507 if ( ${OK_PARA_OMP} ) ; then 1508 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 1509 else 1510 # to be tested : no MPI only OpenMP into MPMD mode 1511 echo "./${ExeNameOut} " >> run_file 1512 fi 1513 fi 1514 fi 1515 done 1516 1517 EXECUTION="${HOST_MPIRUN_COMMAND} -pgmmodel mpmd -cmdfile ./run_file" 1518 1519 IGCM_sys_Chmod u+x run_file 1520 if ( $DEBUG_sys ) ; then 1521 echo "run_file contains : " 1522 cat run_file 1523 fi 1524 1525 else # Only one executable. launch it. 1526 1527 for comp in ${config_ListOfComponents[*]} ; do 1528 1529 eval ExeNameIn=\${config_Executable_${comp}[0]} 1530 eval ExeNameOut=\${config_Executable_${comp}[1]} 1531 1532 [ "X${ExeNameOut}" != X\"\" ] && EXECUTION="time ./${ExeNameOut}" 1533 1534 done 1535 1536 fi 1537 1538 IGCM_debug_Print 1 "sys vargas : execution command is " 1539 IGCM_debug_Print 1 "$EXECUTION" 1540 1541 IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 1542 } 1190 1543 1191 1544 function IGCM_sys_build_run_file { 1192 IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 1193 set -x 1194 if ( $DEBUG_sys ) ; then 1195 echo "IGCM_sys_build_run_file " $@ 1196 fi 1197 1198 NUM_PROC_OASIS=1 1199 1200 # Set the number of processors for OCE here 1201 NUM_PROC_OCE=5 1202 1203 (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - NUM_PROC_OASIS - NUM_PROC_OCE )) 1204 1205 if [ $1 = MPI2 ]; then 1206 echo "IGCM_sys_build_run_file : error - MPI2 not available on vargas. " 1207 IGCM_debug_Exit "IGCM_sys_build_run_file" 1208 elif [ $1 = MPI1 ]; then 1209 cat <<EOF > run_file 1210 ./oasis 1211 EOF 1212 1213 typeset i 1214 (( i = 0 )) 1215 while [ ${i} -lt ${NUM_PROC_ATM} ] ; do 1216 (( i = i + 1 )) 1217 cat <<EOF >> run_file 1218 ./lmdz.x 1219 EOF 1220 done 1221 1222 (( i = 0 )) 1223 while [ ${i} -lt ${NUM_PROC_OCE} ] ; do 1224 (( i = i + 1 )) 1225 cat <<EOF >> run_file 1226 ./opa.xx 1227 EOF 1228 done 1229 1230 wc -l run_file 1231 fi 1232 set +x 1233 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1234 } 1545 1546 IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 1547 1548 }
Note: See TracChangeset
for help on using the changeset viewer.