Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 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 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 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 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 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 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 814 815 816 817 818 819 820 821 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 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 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 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 18x 18x 18x 18x 72x 72x 72x 72x 72x 72x 72x 18x 18x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 72x 72x 72x 72x 72x 72x 72x 72x 72x 72x 72x 72x 72x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 6x 6x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 8x 8x 8x 8x 8x 8x 7x 7x 8x 8x 2x 2x 2x 8x 8x 8x 8x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 28x 28x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 6x 4x 4x 6x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 6x 18x 18x 24x 24x 24x 24x 1x 1x 1x 1x 1x 1x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 28x 28x 28x 24x 24x 24x 4x 4x 4x 4x 4x 28x 8x 8x 8x 4x 2x 2x 2x 2x 2x 28x 4x 6x 6x 2x 2x 6x 4x 2x 2x 35x 35x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 5x 5x 2x 2x 2x 7x 8x 8x 8x 8x 8x 8x 8x 8x 2x 5x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 80x 80x 80x 80x 80x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 80x 80x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | CLASS zcl_abapgit_serialize DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
" Experimental: several objects per task, so the start-up of a new session is paid once per task
" instead of once per object. Enable with experimental feature SERIALIZE_BATCH.
CONSTANTS c_feature_batch TYPE string VALUE 'SERIALIZE_BATCH'.
" Exchanged with Z_ABAPGIT_SERIALIZE_BATCH via EXPORT/IMPORT TO/FROM DATA BUFFER
TYPES:
BEGIN OF ty_parallel_object,
tadir TYPE zif_abapgit_definitions=>ty_tadir,
main_language_only TYPE abap_bool,
END OF ty_parallel_object,
ty_parallel_objects TYPE STANDARD TABLE OF ty_parallel_object WITH DEFAULT KEY,
BEGIN OF ty_parallel_result,
path TYPE string,
not_found TYPE abap_bool,
error TYPE string,
file_item TYPE zif_abapgit_objects=>ty_serialization,
END OF ty_parallel_result,
ty_parallel_results TYPE STANDARD TABLE OF ty_parallel_result WITH DEFAULT KEY.
METHODS constructor
IMPORTING
!io_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit OPTIONAL
!is_local_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings OPTIONAL
RAISING
zcx_abapgit_exception .
METHODS on_end_of_task
IMPORTING
!p_task TYPE clike ##NEEDED.
METHODS on_end_of_batch
IMPORTING
!p_task TYPE clike.
METHODS serialize
IMPORTING
!iv_package TYPE devclass OPTIONAL
!it_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt
!ii_log TYPE REF TO zif_abapgit_log OPTIONAL
!iv_force_sequential TYPE abap_bool DEFAULT abap_false
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_item_tt
RAISING
zcx_abapgit_exception .
METHODS files_local
IMPORTING
!iv_package TYPE devclass
!ii_log TYPE REF TO zif_abapgit_log
!it_filter TYPE zif_abapgit_definitions=>ty_tadir_tt OPTIONAL
!ii_data_config TYPE REF TO zif_abapgit_data_config OPTIONAL
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_item_tt
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
TYPES:
BEGIN OF ty_unsupported_count,
obj_type TYPE tadir-object,
obj_name TYPE tadir-obj_name,
count TYPE i,
END OF ty_unsupported_count .
TYPES:
ty_unsupported_count_tt TYPE HASHED TABLE OF ty_unsupported_count WITH UNIQUE KEY obj_type .
TYPES:
ty_char32 TYPE c LENGTH 32 .
TYPES:
BEGIN OF ty_task,
task TYPE ty_char32,
objects TYPE ty_parallel_objects,
END OF ty_task,
ty_tasks TYPE HASHED TABLE OF ty_task WITH UNIQUE KEY task.
CONSTANTS c_min_batch_size TYPE i VALUE 4.
CONSTANTS c_max_batch_size TYPE i VALUE 20.
" Batch mode gives up when no task finishes for this long per object of the largest outstanding task
CONSTANTS c_wait_seconds TYPE i VALUE 120.
CLASS-DATA gv_max_processes TYPE i .
" Numbers the runs of serialize( ) in this session, so batch task names are unique across runs
CLASS-DATA gv_run TYPE i .
DATA mt_files TYPE zif_abapgit_definitions=>ty_files_item_tt .
DATA mv_free TYPE i .
DATA mi_log TYPE REF TO zif_abapgit_log .
DATA mv_group TYPE rzlli_apcl .
DATA mo_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit.
DATA ms_local_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings.
DATA ms_i18n_params TYPE zif_abapgit_definitions=>ty_i18n_params.
DATA mo_abap_language_version TYPE REF TO zcl_abapgit_abap_language_vers.
DATA mt_wo_translation_patterns TYPE string_table.
DATA mv_batch TYPE abap_bool.
DATA mt_tasks TYPE ty_tasks.
DATA mt_retry TYPE ty_parallel_objects.
METHODS add_apack
IMPORTING
!iv_package TYPE devclass
CHANGING
!ct_files TYPE zif_abapgit_definitions=>ty_files_item_tt
RAISING
zcx_abapgit_exception .
METHODS add_data
IMPORTING
!ii_data_config TYPE REF TO zif_abapgit_data_config
!ii_log TYPE REF TO zif_abapgit_log
CHANGING
!ct_files TYPE zif_abapgit_definitions=>ty_files_item_tt
RAISING
zcx_abapgit_exception .
METHODS add_dot_abapgit
CHANGING
!ct_files TYPE zif_abapgit_definitions=>ty_files_item_tt
RAISING
zcx_abapgit_exception .
METHODS add_to_return
IMPORTING
!iv_path TYPE string
!is_file_item TYPE zif_abapgit_objects=>ty_serialization .
METHODS run_parallel
IMPORTING
!is_tadir TYPE zif_abapgit_definitions=>ty_tadir
!iv_task TYPE ty_char32
RAISING
zcx_abapgit_exception .
METHODS run_batch
IMPORTING
!it_objects TYPE ty_parallel_objects
!iv_task TYPE ty_char32
RAISING
zcx_abapgit_exception .
METHODS to_parallel_object
IMPORTING
!is_tadir TYPE zif_abapgit_definitions=>ty_tadir
RETURNING
VALUE(rs_object) TYPE ty_parallel_object
RAISING
zcx_abapgit_exception.
METHODS determine_batch_size
IMPORTING
!iv_count TYPE i
!iv_processes TYPE i
RETURNING
VALUE(rv_size) TYPE i.
METHODS add_batch_results
IMPORTING
!it_results TYPE ty_parallel_results.
METHODS handle_batch_result
IMPORTING
!iv_task TYPE clike
!iv_failed TYPE abap_bool
!iv_message TYPE csequence OPTIONAL
!it_results TYPE ty_parallel_results OPTIONAL.
METHODS wait_for_callback
IMPORTING
!iv_free TYPE i.
METHODS wait_for_batches
IMPORTING
!iv_free TYPE i
RAISING
zcx_abapgit_exception.
METHODS finish_batches
IMPORTING
!iv_max TYPE i
RAISING
zcx_abapgit_exception.
METHODS run_sequential
IMPORTING
!is_tadir TYPE zif_abapgit_definitions=>ty_tadir
RAISING
zcx_abapgit_exception .
METHODS add_objects
IMPORTING
!iv_package TYPE devclass
!ii_log TYPE REF TO zif_abapgit_log
!it_filter TYPE zif_abapgit_definitions=>ty_tadir_tt OPTIONAL
CHANGING
!ct_files TYPE zif_abapgit_definitions=>ty_files_item_tt
RAISING
zcx_abapgit_exception .
METHODS determine_rfc_server_group
RETURNING
VALUE(rv_group) TYPE rzlli_apcl
RAISING
zcx_abapgit_exception.
METHODS determine_max_processes
IMPORTING
!iv_force_sequential TYPE abap_bool DEFAULT abap_false
iv_package TYPE devclass
RETURNING
VALUE(rv_processes) TYPE i
RAISING
zcx_abapgit_exception .
METHODS filter_unsupported_objects
CHANGING
!ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt .
METHODS filter_ignored_objects
IMPORTING
!iv_package TYPE devclass
CHANGING
!ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
METHODS is_parallelization_possible
RETURNING
VALUE(rv_result) TYPE abap_bool.
METHODS is_no_parallel
IMPORTING
!iv_object_type TYPE tadir-object
RETURNING
VALUE(rv_result) TYPE abap_bool.
ENDCLASS.
CLASS zcl_abapgit_serialize IMPLEMENTATION.
METHOD add_apack.
DATA ls_apack_file TYPE zif_abapgit_git_definitions=>ty_file.
FIELD-SYMBOLS <ls_file> LIKE LINE OF ct_files.
ls_apack_file = zcl_abapgit_apack_helper=>to_file( iv_package ).
IF ls_apack_file IS NOT INITIAL.
APPEND INITIAL LINE TO ct_files ASSIGNING <ls_file>.
<ls_file>-file = ls_apack_file.
ENDIF.
ENDMETHOD.
METHOD add_batch_results.
FIELD-SYMBOLS <ls_result> LIKE LINE OF it_results.
LOOP AT it_results ASSIGNING <ls_result>.
IF <ls_result>-error IS NOT INITIAL.
IF mi_log IS BOUND.
mi_log->add_error(
iv_msg = <ls_result>-error
is_item = <ls_result>-file_item-item ).
ENDIF.
ELSEIF <ls_result>-not_found = abap_false.
add_to_return(
is_file_item = <ls_result>-file_item
iv_path = <ls_result>-path ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD add_data.
DATA lt_files TYPE zif_abapgit_git_definitions=>ty_files_tt.
DATA ls_file LIKE LINE OF lt_files.
DATA lx_error TYPE REF TO zcx_abapgit_exception.
FIELD-SYMBOLS <ls_return> LIKE LINE OF ct_files.
IF ii_data_config IS INITIAL.
RETURN.
ENDIF.
lt_files = ii_data_config->to_json( ).
LOOP AT lt_files INTO ls_file.
APPEND INITIAL LINE TO ct_files ASSIGNING <ls_return>.
<ls_return>-file = ls_file.
" Derive object from config filename (namespace + escaping)
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = <ls_return>-file-filename
iv_path = <ls_return>-file-path
io_dot = mo_dot_abapgit
IMPORTING
es_item = <ls_return>-item ).
<ls_return>-item-obj_type = zif_abapgit_data_config=>c_data_type-tabu. " todo
ENDLOOP.
TRY.
lt_files = zcl_abapgit_data_factory=>get_serializer( )->serialize( ii_data_config ).
CATCH zcx_abapgit_exception INTO lx_error.
IF ii_log IS BOUND.
ii_log->add_exception( lx_error ).
ENDIF.
RETURN.
ENDTRY.
LOOP AT lt_files INTO ls_file.
APPEND INITIAL LINE TO ct_files ASSIGNING <ls_return>.
<ls_return>-file = ls_file.
" Derive object from data filename (namespace + escaping)
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = <ls_return>-file-filename
iv_path = <ls_return>-file-path
io_dot = mo_dot_abapgit
IMPORTING
es_item = <ls_return>-item ).
ENDLOOP.
ENDMETHOD.
METHOD add_dot_abapgit.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF ct_files.
APPEND INITIAL LINE TO ct_files ASSIGNING <ls_file>.
<ls_file>-file = mo_dot_abapgit->to_file( ).
ENDMETHOD.
METHOD add_objects.
DATA: lo_filter TYPE REF TO zcl_abapgit_repo_filter,
lv_force TYPE abap_bool,
lt_found LIKE ct_files,
lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt.
" In batch mode, existence is checked by serialize( ), in parallel where possible
lt_tadir = zcl_abapgit_factory=>get_tadir( )->read(
iv_package = iv_package
iv_ignore_subpackages = ms_local_settings-ignore_subpackages
iv_only_local_objects = ms_local_settings-only_local_objects
io_dot = mo_dot_abapgit
ii_log = ii_log
it_filter = it_filter
iv_check_exists = boolc( mv_batch = abap_false ) ).
CREATE OBJECT lo_filter.
lo_filter->apply( EXPORTING it_filter = it_filter
CHANGING ct_tadir = lt_tadir ).
* if there are less than 10 objects run in single thread
* this helps a lot when debugging, plus performance gain
* with low number of objects does not matter much
lv_force = boolc( lines( lt_tadir ) < 10 ).
lt_found = serialize(
iv_package = iv_package
it_tadir = lt_tadir
ii_log = ii_log
iv_force_sequential = lv_force ).
APPEND LINES OF lt_found TO ct_files.
ENDMETHOD.
METHOD add_to_return.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF is_file_item-files,
<ls_return> LIKE LINE OF mt_files.
LOOP AT is_file_item-files ASSIGNING <ls_file>.
APPEND INITIAL LINE TO mt_files ASSIGNING <ls_return>.
<ls_return>-file = <ls_file>.
<ls_return>-file-path = iv_path.
<ls_return>-item = is_file_item-item.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
mv_group = determine_rfc_server_group( ).
mv_batch = zcl_abapgit_feature=>is_enabled( c_feature_batch ).
mo_dot_abapgit = io_dot_abapgit.
ms_local_settings = is_local_settings.
IF io_dot_abapgit IS BOUND.
ms_i18n_params = io_dot_abapgit->determine_i18n_parameters( is_local_settings-main_language_only ).
mt_wo_translation_patterns =
zcl_abapgit_i18n_params=>normalize_obj_patterns( io_dot_abapgit->get_objs_without_translation( ) ).
ELSE.
ms_i18n_params-main_language = sy-langu.
ms_i18n_params-main_language_only = is_local_settings-main_language_only.
ENDIF.
ms_i18n_params-suppress_po_comments = is_local_settings-suppress_lxe_po_comments.
IF mo_dot_abapgit IS NOT INITIAL.
CREATE OBJECT mo_abap_language_version
EXPORTING
io_dot_abapgit = mo_dot_abapgit.
ENDIF.
ENDMETHOD.
METHOD determine_batch_size.
" Keep batches up to c_max_batch_size while plenty of objects remain, then shrink toward the
" tail so processes finish close together without spawning tiny single-object tasks
rv_size = iv_count DIV ( nmax( val1 = iv_processes
val2 = 1 ) * 2 ).
IF rv_size > c_max_batch_size.
rv_size = c_max_batch_size.
ELSEIF rv_size < c_min_batch_size.
rv_size = c_min_batch_size.
ENDIF.
ENDMETHOD.
METHOD determine_max_processes.
DATA: li_exit TYPE REF TO zif_abapgit_exit.
DATA lv_available_sessions TYPE i.
IF iv_force_sequential = abap_true OR is_parallelization_possible( ) = abap_false.
rv_processes = 1.
RETURN.
ENDIF.
IF gv_max_processes IS INITIAL.
gv_max_processes = zcl_abapgit_factory=>get_environment( )->init_parallel_processing( mv_group ).
IF gv_max_processes > 1.
gv_max_processes = gv_max_processes - 1.
ENDIF.
IF gv_max_processes > 32.
" https://en.wikipedia.org/wiki/Amdahl%27s_law
gv_max_processes = 32.
ENDIF.
ENDIF.
IF gv_max_processes IS INITIAL.
" fallback to running sequentially.
gv_max_processes = 1.
ENDIF.
rv_processes = gv_max_processes.
ASSERT rv_processes >= 1.
" Avoid going over the maximum available user sessions
IF sy-batch IS INITIAL.
lv_available_sessions = zcl_abapgit_factory=>get_environment( )->get_available_user_sessions( ).
IF lv_available_sessions = 0.
" No available session -> disable parallel processing
rv_processes = 1.
ELSEIF rv_processes > lv_available_sessions.
rv_processes = lv_available_sessions.
ENDIF.
ENDIF.
ASSERT rv_processes >= 1.
" Exit setting has highest priority to change maximum sessions
li_exit = zcl_abapgit_exit=>get_instance( ).
li_exit->change_max_parallel_processes(
EXPORTING
iv_package = iv_package
CHANGING
cv_max_processes = rv_processes ).
ASSERT rv_processes >= 1.
ENDMETHOD.
METHOD determine_rfc_server_group.
DATA:
li_exit TYPE REF TO zif_abapgit_exit,
lv_exists TYPE abap_bool.
" According to SAP Note 3215918 it's recommended NOT to use this group anymore.
" However, we keep it for compatibility. If it does not exist, we switch to the
" recommended DEFAULT behaviour.
rv_group = 'parallel_generators'.
li_exit = zcl_abapgit_exit=>get_instance( ).
li_exit->change_rfc_server_group( CHANGING cv_group = rv_group ).
" Check if RFC server group exists and fallback to the default
lv_exists = zcl_abapgit_factory=>get_environment( )->check_parallel_processing( rv_group ).
IF lv_exists = abap_false.
rv_group = ''.
ENDIF.
ENDMETHOD.
METHOD files_local.
* serializes objects, including .abapgit.xml, apack, and takes into account local settings
DATA li_exit TYPE REF TO zif_abapgit_exit.
add_dot_abapgit( CHANGING ct_files = rt_files ).
add_apack(
EXPORTING
iv_package = iv_package
CHANGING
ct_files = rt_files ).
add_data(
EXPORTING
ii_data_config = ii_data_config
ii_log = ii_log
CHANGING
ct_files = rt_files ).
add_objects(
EXPORTING
iv_package = iv_package
ii_log = ii_log
it_filter = it_filter
CHANGING
ct_files = rt_files ).
* Call postprocessing
li_exit = zcl_abapgit_exit=>get_instance( ).
li_exit->serialize_postprocess(
EXPORTING
iv_package = iv_package
ii_log = ii_log
CHANGING
ct_files = rt_files ).
ENDMETHOD.
METHOD filter_ignored_objects.
DATA:
ls_ignored_count TYPE ty_unsupported_count,
lt_ignored_count TYPE ty_unsupported_count_tt,
lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic,
ls_item TYPE zif_abapgit_definitions=>ty_item,
lv_path TYPE string,
lv_filename TYPE string.
FIELD-SYMBOLS:
<ls_tadir> LIKE LINE OF ct_tadir,
<ls_ignored_count> TYPE ty_unsupported_count.
" Ignore logic requires .abapGit.xml
IF mo_dot_abapgit IS INITIAL OR iv_package IS INITIAL OR mi_log IS INITIAL.
RETURN.
ENDIF.
lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ).
LOOP AT ct_tadir ASSIGNING <ls_tadir>.
CLEAR: ls_ignored_count.
ls_item-obj_type = <ls_tadir>-object.
ls_item-obj_name = <ls_tadir>-obj_name.
IF <ls_tadir>-devclass IS NOT INITIAL.
lv_path = lo_folder_logic->package_to_path(
iv_top = iv_package
io_dot = mo_dot_abapgit
iv_package = <ls_tadir>-devclass ).
ELSE.
lv_path = mo_dot_abapgit->get_starting_folder( ).
ENDIF.
lv_filename = zcl_abapgit_filename_logic=>object_to_file(
is_item = ls_item
iv_ext = '*' ).
IF mo_dot_abapgit->is_ignored(
iv_path = lv_path
iv_filename = lv_filename ) = abap_false.
CONTINUE.
ENDIF.
READ TABLE lt_ignored_count ASSIGNING <ls_ignored_count> WITH TABLE KEY obj_type = <ls_tadir>-object.
IF sy-subrc <> 0.
ls_ignored_count-obj_type = <ls_tadir>-object.
ls_ignored_count-count = 1.
ls_ignored_count-obj_name = <ls_tadir>-obj_name.
INSERT ls_ignored_count INTO TABLE lt_ignored_count ASSIGNING <ls_ignored_count>.
ELSE.
CLEAR: <ls_ignored_count>-obj_name.
<ls_ignored_count>-count = <ls_ignored_count>-count + 1.
ENDIF.
" init object so we can remove these entries afterward
CLEAR <ls_tadir>-object.
ENDLOOP.
IF lt_ignored_count IS INITIAL.
RETURN.
ENDIF.
" remove ignored objects
DELETE ct_tadir WHERE object IS INITIAL.
LOOP AT lt_ignored_count ASSIGNING <ls_ignored_count>.
IF <ls_ignored_count>-count = 1.
mi_log->add_warning( |Object { <ls_ignored_count>-obj_type } { <ls_ignored_count>-obj_name } ignored| ).
ELSE.
mi_log->add_warning( |Object type { <ls_ignored_count>-obj_type } with | &&
|{ <ls_ignored_count>-count } objects ignored| ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD filter_unsupported_objects.
DATA: ls_unsupported_count TYPE ty_unsupported_count,
lt_supported_types TYPE zif_abapgit_objects=>ty_types_tt,
lt_unsupported_count TYPE ty_unsupported_count_tt.
FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF ct_tadir,
<ls_unsupported_count> TYPE ty_unsupported_count.
lt_supported_types = zcl_abapgit_objects=>supported_list( ).
LOOP AT ct_tadir ASSIGNING <ls_tadir>.
CLEAR: ls_unsupported_count.
READ TABLE lt_supported_types WITH KEY table_line = <ls_tadir>-object TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
READ TABLE lt_unsupported_count ASSIGNING <ls_unsupported_count>
WITH TABLE KEY obj_type = <ls_tadir>-object.
IF sy-subrc <> 0.
ls_unsupported_count-obj_type = <ls_tadir>-object.
ls_unsupported_count-count = 1.
ls_unsupported_count-obj_name = <ls_tadir>-obj_name.
INSERT ls_unsupported_count INTO TABLE lt_unsupported_count ASSIGNING <ls_unsupported_count>.
ELSE.
CLEAR: <ls_unsupported_count>-obj_name.
<ls_unsupported_count>-count = <ls_unsupported_count>-count + 1.
ENDIF.
CLEAR: <ls_tadir>-object.
ENDLOOP.
IF lt_unsupported_count IS INITIAL.
RETURN.
ENDIF.
DELETE ct_tadir WHERE object IS INITIAL.
IF mi_log IS BOUND.
LOOP AT lt_unsupported_count ASSIGNING <ls_unsupported_count>.
IF <ls_unsupported_count>-count = 1.
mi_log->add_error( |Object type { <ls_unsupported_count>-obj_type } not supported, | &&
|{ <ls_unsupported_count>-obj_name } ignored| ).
ELSE.
mi_log->add_error( |Object type { <ls_unsupported_count>-obj_type } not supported, | &&
|{ <ls_unsupported_count>-count } objects ignored| ).
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD is_no_parallel.
" Currently know object types that do not support parallel processing:
" ECTC/ECTD - ECATT Test Config/Data (see #7148)
" Should this list become longer, it should become a flag of the object type serializer
IF iv_object_type = 'ECTC' OR iv_object_type = 'ECTD'.
rv_result = abap_true.
ENDIF.
ENDMETHOD.
METHOD is_parallelization_possible.
DATA lv_function TYPE c LENGTH 30.
IF mv_batch = abap_true.
lv_function = 'Z_ABAPGIT_SERIALIZE_BATCH'.
ELSE.
lv_function = 'Z_ABAPGIT_SERIALIZE_PARALLEL'.
ENDIF.
rv_result = boolc( zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_false
AND zcl_abapgit_persist_factory=>get_settings( )->read( )->get_parallel_proc_disabled( ) = abap_false
" The function module below should always exist here as is_merged evaluated to false above.
" It does however not exist in the transpiled version which then causes unit tests to fail.
" Therefore the check needs to stay.
AND zcl_abapgit_factory=>get_function_module(
)->function_exists( lv_function ) = abap_true ).
ENDMETHOD.
METHOD on_end_of_batch.
* this method will be called from the parallel processing, thus it must be public
DATA: lv_result TYPE xstring,
lv_mess TYPE c LENGTH 200,
lv_failed TYPE abap_bool,
lt_results TYPE ty_parallel_results.
RECEIVE RESULTS FROM FUNCTION 'Z_ABAPGIT_SERIALIZE_BATCH'
IMPORTING
ev_result = lv_result
EXCEPTIONS
system_failure = 1 MESSAGE lv_mess
communication_failure = 2 MESSAGE lv_mess
OTHERS = 3.
IF sy-subrc <> 0.
lv_failed = abap_true.
IF lv_mess IS INITIAL.
lv_mess = |{ sy-msgv1 }{ sy-msgv2 }{ sy-msgv3 }{ sy-msgv4 }|.
ENDIF.
ELSE.
IMPORT data = lt_results FROM DATA BUFFER lv_result. "#EC CI_SUBRC
ASSERT sy-subrc = 0.
ENDIF.
handle_batch_result(
iv_task = p_task
iv_failed = lv_failed
iv_message = lv_mess
it_results = lt_results ).
ENDMETHOD.
METHOD handle_batch_result.
DATA: ls_task TYPE ty_task,
ls_item TYPE zif_abapgit_definitions=>ty_item.
FIELD-SYMBOLS <ls_object> LIKE LINE OF ls_task-objects.
READ TABLE mt_tasks INTO ls_task WITH TABLE KEY task = iv_task.
IF sy-subrc <> 0.
" Late callback of a run that has given up waiting for it
RETURN.
ENDIF.
DELETE TABLE mt_tasks WITH TABLE KEY task = iv_task.
IF iv_failed = abap_true.
IF lines( ls_task-objects ) > 1.
" Retry one by one, so the object that broke the task does not take the others with it
APPEND LINES OF ls_task-objects TO mt_retry.
ELSEIF mi_log IS BOUND.
READ TABLE ls_task-objects ASSIGNING <ls_object> INDEX 1.
IF sy-subrc = 0.
ls_item-obj_type = <ls_object>-tadir-object.
ls_item-obj_name = <ls_object>-tadir-obj_name.
ls_item-devclass = <ls_object>-tadir-devclass.
ENDIF.
mi_log->add_error(
iv_msg = iv_message
is_item = ls_item ).
ENDIF.
ELSE.
add_batch_results( it_results ).
ENDIF.
mv_free = mv_free + 1.
ENDMETHOD.
METHOD wait_for_callback.
WAIT UNTIL mv_free > iv_free UP TO c_wait_seconds SECONDS.
ENDMETHOD.
METHOD wait_for_batches.
DATA: lv_free TYPE i,
lv_stalls TYPE i,
lv_limit TYPE i,
lv_count TYPE i,
lv_first TYPE string.
FIELD-SYMBOLS: <ls_task> LIKE LINE OF mt_tasks,
<ls_object> TYPE ty_parallel_object.
WHILE mv_free < iv_free.
lv_free = mv_free.
wait_for_callback( lv_free ).
IF mv_free > lv_free.
CLEAR lv_stalls.
CONTINUE.
ENDIF.
" Per-object mode gives each object c_wait_seconds. A task is only given up once it had that
" long for each of its objects, i.e. after one wait per object of the largest outstanding task
lv_stalls = lv_stalls + 1.
lv_limit = 1.
LOOP AT mt_tasks ASSIGNING <ls_task>.
lv_limit = nmax( val1 = lv_limit
val2 = lines( <ls_task>-objects ) ).
ENDLOOP.
IF lv_stalls < lv_limit.
CONTINUE.
ENDIF.
" No task finished in time, or none can finish any more. Returning now would leave the
" outstanding objects out of the result without an error, so they would look deleted
LOOP AT mt_tasks ASSIGNING <ls_task>.
LOOP AT <ls_task>-objects ASSIGNING <ls_object>.
lv_count = lv_count + 1.
IF lv_first IS INITIAL.
lv_first = |{ <ls_object>-tadir-object } { <ls_object>-tadir-obj_name }|.
ENDIF.
ENDLOOP.
ENDLOOP.
zcx_abapgit_exception=>raise( |Serialization incomplete, no parallel task finished within {
lv_stalls * c_wait_seconds } seconds. { lv_count } objects outstanding, e.g. { lv_first }| ).
ENDWHILE.
ENDMETHOD.
METHOD finish_batches.
DATA: lt_retry TYPE ty_parallel_objects,
lt_batch TYPE ty_parallel_objects,
lv_retry TYPE i.
FIELD-SYMBOLS <ls_object> LIKE LINE OF lt_retry.
" A failed task queues its objects in mt_retry when its callback arrives, which can be any time
" until the last task has finished. So the queue is only complete once nothing is outstanding
DO.
wait_for_batches( iv_max ).
IF mt_retry IS INITIAL.
EXIT.
ENDIF.
lt_retry = mt_retry.
CLEAR mt_retry.
LOOP AT lt_retry ASSIGNING <ls_object>.
lv_retry = lv_retry + 1.
CLEAR lt_batch.
APPEND <ls_object> TO lt_batch.
wait_for_batches( 1 ).
run_batch(
it_objects = lt_batch
iv_task = |retry-{ lv_retry }| ).
ENDLOOP.
ENDDO.
ENDMETHOD.
METHOD on_end_of_task.
* this method will be called from the parallel processing, thus it must be public
DATA: lv_result TYPE xstring,
lv_path TYPE string,
lv_mess TYPE c LENGTH 200,
ls_file_item TYPE zif_abapgit_objects=>ty_serialization.
RECEIVE RESULTS FROM FUNCTION 'Z_ABAPGIT_SERIALIZE_PARALLEL'
IMPORTING
ev_result = lv_result
ev_path = lv_path
EXCEPTIONS
error = 1
system_failure = 2 MESSAGE lv_mess
communication_failure = 3 MESSAGE lv_mess
OTHERS = 4.
IF sy-subrc <> 0.
IF NOT mi_log IS INITIAL.
IF NOT lv_mess IS INITIAL.
mi_log->add_error( lv_mess ).
ELSE.
mi_log->add_error( |{ sy-msgv1 }{ sy-msgv2 }{ sy-msgv3 }{ sy-msgv4 }| ).
ENDIF.
ENDIF.
ELSE.
IMPORT data = ls_file_item FROM DATA BUFFER lv_result. "#EC CI_SUBRC
ASSERT sy-subrc = 0.
add_to_return( is_file_item = ls_file_item
iv_path = lv_path ).
ENDIF.
mv_free = mv_free + 1.
ENDMETHOD.
METHOD run_batch.
DATA: lv_msg TYPE c LENGTH 100,
lv_objects TYPE xstring,
ls_task TYPE ty_task,
lv_free LIKE mv_free.
DATA lv_abap_language_version TYPE zif_abapgit_aff_types_v1=>ty_abap_language_version.
ASSERT mv_free > 0.
IF mo_abap_language_version IS NOT INITIAL.
lv_abap_language_version = mo_abap_language_version->get_repo_abap_language_version( ).
ENDIF.
EXPORT data = it_objects TO DATA BUFFER lv_objects.
DO.
" A task given up by an earlier run may still call back; its name must not match a task of this run
ls_task-task = |{ gv_run }-{ iv_task }-{ sy-index }|.
" An initial server group is handled like DEFAULT meaning all instances are used
CALL FUNCTION 'Z_ABAPGIT_SERIALIZE_BATCH'
STARTING NEW TASK ls_task-task
DESTINATION IN GROUP mv_group
CALLING on_end_of_batch ON END OF TASK
EXPORTING
iv_objects = lv_objects
iv_abap_language_vers = lv_abap_language_version
iv_language = ms_i18n_params-main_language
iv_suppress_po_comments = ms_i18n_params-suppress_po_comments
it_translation_langs = ms_i18n_params-translation_languages
iv_use_lxe = ms_i18n_params-use_lxe
EXCEPTIONS
system_failure = 1 MESSAGE lv_msg
communication_failure = 2 MESSAGE lv_msg
resource_failure = 3
OTHERS = 4.
IF sy-subrc = 3.
lv_free = mv_free.
WAIT UNTIL mv_free <> lv_free UP TO 1 SECONDS.
CONTINUE.
ELSEIF sy-subrc <> 0.
ASSERT lv_msg = '' AND 0 = 1.
ENDIF.
EXIT.
ENDDO.
ls_task-objects = it_objects.
INSERT ls_task INTO TABLE mt_tasks.
mv_free = mv_free - 1.
ENDMETHOD.
METHOD run_parallel.
DATA: lv_msg TYPE c LENGTH 100,
lv_task TYPE c LENGTH 32,
lv_free LIKE mv_free.
DATA lv_abap_language_version TYPE zif_abapgit_aff_types_v1=>ty_abap_language_version.
DATA lv_main_language_only TYPE abap_bool.
ASSERT mv_free > 0.
IF mo_abap_language_version IS NOT INITIAL.
lv_abap_language_version = mo_abap_language_version->get_repo_abap_language_version( ).
ENDIF.
lv_main_language_only = ms_i18n_params-main_language_only.
IF lv_main_language_only = abap_false AND mt_wo_translation_patterns IS NOT INITIAL.
lv_main_language_only = zcl_abapgit_i18n_params=>match_obj_patterns(
is_tadir = is_tadir
it_wo_translation_patterns = mt_wo_translation_patterns ).
ENDIF.
DO.
lv_task = |{ iv_task }-{ sy-index }|.
" An initial server group is handled like DEFAULT meaning all instances are used
CALL FUNCTION 'Z_ABAPGIT_SERIALIZE_PARALLEL'
STARTING NEW TASK lv_task
DESTINATION IN GROUP mv_group
CALLING on_end_of_task ON END OF TASK
EXPORTING
is_tadir = is_tadir
iv_abap_language_vers = lv_abap_language_version
iv_language = ms_i18n_params-main_language
iv_path = is_tadir-path
iv_main_language_only = lv_main_language_only
iv_suppress_po_comments = ms_i18n_params-suppress_po_comments
it_translation_langs = ms_i18n_params-translation_languages
iv_use_lxe = ms_i18n_params-use_lxe
EXCEPTIONS
system_failure = 1 MESSAGE lv_msg
communication_failure = 2 MESSAGE lv_msg
resource_failure = 3
OTHERS = 4.
IF sy-subrc = 3.
lv_free = mv_free.
WAIT UNTIL mv_free <> lv_free UP TO 1 SECONDS.
CONTINUE.
ELSEIF sy-subrc <> 0.
ASSERT lv_msg = '' AND 0 = 1.
ENDIF.
EXIT.
ENDDO.
mv_free = mv_free - 1.
ENDMETHOD.
METHOD run_sequential.
DATA: lx_error TYPE REF TO zcx_abapgit_exception,
ls_i18n_params LIKE ms_i18n_params,
ls_file_item TYPE zif_abapgit_objects=>ty_serialization.
ls_file_item-item-obj_type = is_tadir-object.
ls_file_item-item-obj_name = is_tadir-obj_name.
ls_file_item-item-devclass = is_tadir-devclass.
ls_file_item-item-srcsystem = is_tadir-srcsystem.
ls_file_item-item-origlang = is_tadir-masterlang.
" In batch mode, TADIR is read without existence check
IF mv_batch = abap_true AND zcl_abapgit_objects=>exists( ls_file_item-item ) = abap_false.
RETURN.
ENDIF.
IF mo_abap_language_version IS NOT INITIAL.
ls_file_item-item-abap_language_version = mo_abap_language_version->get_repo_abap_language_version( ).
ENDIF.
ls_i18n_params = ms_i18n_params.
IF ls_i18n_params-main_language_only = abap_false AND mt_wo_translation_patterns IS NOT INITIAL.
ls_i18n_params-main_language_only = zcl_abapgit_i18n_params=>match_obj_patterns(
is_tadir = is_tadir
it_wo_translation_patterns = mt_wo_translation_patterns ).
ENDIF.
TRY.
ls_file_item = zcl_abapgit_objects=>serialize(
is_item = ls_file_item-item
io_i18n_params = zcl_abapgit_i18n_params=>new( is_params = ls_i18n_params ) ).
add_to_return( is_file_item = ls_file_item
iv_path = is_tadir-path ).
CATCH zcx_abapgit_exception INTO lx_error.
IF NOT mi_log IS INITIAL.
mi_log->add_exception(
ix_exc = lx_error
is_item = ls_file_item-item ).
ENDIF.
ENDTRY.
ENDMETHOD.
METHOD serialize.
* serializes only objects
DATA: lv_max TYPE i,
lv_count TYPE i,
lv_index TYPE i,
lv_batch_size TYPE i,
lt_batch TYPE ty_parallel_objects,
li_progress TYPE REF TO zif_abapgit_progress,
lo_timer TYPE REF TO zcl_abapgit_timer,
lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt.
FIELD-SYMBOLS <ls_tadir> LIKE LINE OF it_tadir.
CLEAR: mt_files, mt_tasks, mt_retry.
gv_run = gv_run + 1.
lv_max = determine_max_processes( iv_force_sequential = iv_force_sequential
iv_package = iv_package ).
mv_free = lv_max.
mi_log = ii_log.
lt_tadir = it_tadir.
filter_unsupported_objects( CHANGING ct_tadir = lt_tadir ).
filter_ignored_objects(
EXPORTING
iv_package = iv_package
CHANGING
ct_tadir = lt_tadir ).
lv_count = lines( lt_tadir ).
lv_batch_size = determine_batch_size( iv_count = lv_count
iv_processes = lv_max ).
li_progress = zcl_abapgit_progress=>get_instance( lv_count ).
lo_timer = zcl_abapgit_timer=>create(
iv_text = 'Serialize:'
iv_count = lv_count )->start( ).
LOOP AT lt_tadir ASSIGNING <ls_tadir>.
lv_index = sy-tabix.
IF lv_max = 1 OR is_no_parallel( <ls_tadir>-object ) = abap_true.
li_progress->show(
iv_current = lv_index
iv_text = |Serialize { <ls_tadir>-obj_name }, { lv_max } thread| ).
run_sequential( <ls_tadir> ).
ELSEIF mv_batch = abap_true.
APPEND to_parallel_object( <ls_tadir> ) TO lt_batch.
IF lines( lt_batch ) >= lv_batch_size.
li_progress->show(
iv_current = lv_index
iv_text = |Serialize { <ls_tadir>-obj_name }, { lv_max } threads| ).
wait_for_batches( 1 ).
run_batch(
it_objects = lt_batch
iv_task = |{ lv_index }| ).
CLEAR lt_batch.
lv_batch_size = determine_batch_size( iv_count = lv_count - lv_index
iv_processes = lv_max ).
ENDIF.
ELSE.
li_progress->show(
iv_current = lv_index
iv_text = |Serialize { <ls_tadir>-obj_name }, { lv_max } threads| ).
run_parallel(
is_tadir = <ls_tadir>
iv_task = |{ lv_index }| ).
WAIT UNTIL mv_free > 0 UP TO 120 SECONDS.
ENDIF.
ENDLOOP.
IF lt_batch IS NOT INITIAL.
wait_for_batches( 1 ).
run_batch(
it_objects = lt_batch
iv_task = |{ lv_count }-last| ).
ENDIF.
IF mv_batch = abap_true.
finish_batches( lv_max ).
ELSE.
WAIT UNTIL mv_free = lv_max UP TO 120 SECONDS.
ENDIF.
li_progress->off( ).
rt_files = mt_files.
FREE mt_files.
lo_timer->end( abap_true ).
ENDMETHOD.
METHOD to_parallel_object.
rs_object-tadir = is_tadir.
rs_object-main_language_only = ms_i18n_params-main_language_only.
IF rs_object-main_language_only = abap_false AND mt_wo_translation_patterns IS NOT INITIAL.
rs_object-main_language_only = zcl_abapgit_i18n_params=>match_obj_patterns(
is_tadir = is_tadir
it_wo_translation_patterns = mt_wo_translation_patterns ).
ENDIF.
ENDMETHOD.
ENDCLASS.
|