admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
Quintiq file version 2.0
#parent: #root
Method PTF_CheckClientStatus (
  structured[LibPTF_TestScript] testscripts,
  String str
) as String id:Method_LibPTF_pnlTestController_PTF_CheckClientStatus
{
  #keys: '[102890.0.1871494620]'
  Body:
  [*
    // Checks the overall PTF execution status and perform some post-PTF execution routine when all the scripts has been executed successfully
    alldone         := true;
    tracker         := construct( Strings );
    rowDelimiter    := LibPTF_Util::StringListRowDelimiter();
    columnDelimiter := LibPTF_Util::StringListColumnDelimiter();
    rows            := str.Tokenize( rowDelimiter );
    
    traverse( rows, Elements, row )
    {
      columns := row.Tokenize( columnDelimiter );
    
      user                := columns.Element( 0 );
      reqsessions         := [Number]columns.Element( 1 );
      reqconsessions      := [Number]columns.Element( 2 );
      executedsessions    := [Number]columns.Element( 3 );
      executingsessions   := [Number]columns.Element( 4 );
      remainingsessions   := [Number]columns.Element( 5 );
      startime            := columns.Element( 6 );
      endtime             := columns.Element( 7 );
      // elapsedtime      := columns.Element( 8 ); Not being used
      startoffset         := columns.Element( 9 );
    
      remainingsessions := reqsessions - executedsessions;
    
      script := select( testscripts,
                        Elements,
                        s,
                        true,
                        s.User() = user
                      );
    
      this.PTF_CheckClientStatusByScript( script,
                                          executedsessions,
                                          reqsessions,
                                          executingsessions,
                                          endtime,
                                          alldone
                                        );
    
      columns.Flush();
      columns.Add( user )
      columns.Add( [String]reqsessions );
      columns.Add( [String]reqconsessions );
      columns.Add( [String]executedsessions );
      columns.Add( [String]executingsessions );
      columns.Add( [String]remainingsessions );
      columns.Add( startime );
      columns.Add( endtime );
      columns.Add( this.PTF_GetTotalDuration( startime, endtime ) );
      columns.Add( startoffset );
    
      tracker.Add( columns.ToString( columnDelimiter ) );
    }
    
    // After completed all test
    // clock the endtime time
    // disable timer
    if( alldone )
    {
      this.gt().Enabled( false );
      lblEndTime.Text( this.PTF_GetCurrentDatetime() );
    
      // Only execute this if Python related execution is chosen to be executed
      if( this.chkExecutePythonScripts().Checked() )
      {
        // Execute the PTF_MergeResult.bat to merge the result log files
        LibPTF::Execute( this.PTF_GetBatchFileFullPathForMergeResult() );
      }
    
      if( this.PTF_IsCopyQTransLogs() )
      {
        LibPTF::Execute( this.PTF_GetBatchFileFullPathForCollectQServerLog() );
      }
    
      // Completed all test, remove batch file
      OS::RemoveFile( this.PTF_GetBatchFileFullPathForKickStartClient() );
      OS::RemoveFile( this.PTF_GetBatchFileFullPathForStartClient() );
    
      this.PTF_RunPostExecution();
    
      //Logs a line in log file as an indication of the end of a PTF run
      LibPTF::LogRunEnded();
    }
    
    return tracker.ToString( rowDelimiter );
  *]
}