Skip to content

Commit

Permalink
HPCC-31616 Record WhenStarted for dfu file operations
Browse files Browse the repository at this point in the history
Signed-off-by: Shamser Ahmed <[email protected]>
  • Loading branch information
shamser committed Apr 22, 2024
1 parent 931ee83 commit aa773e3
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions plugins/fileservices/fileservices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ static void blockUntilComplete(const char * label, IClientFileSpray &server, ICo

VStringBuffer reason("Blocked by fileservice activity: %s, workunit: %s", label, wuid);
setWorkunitState(ctx, WUStateBlocked, reason.str());

bool isStartTimeRecorded = false;
while(true)
{

Expand All @@ -630,6 +630,7 @@ static void blockUntilComplete(const char * label, IClientFileSpray &server, ICo
}

IConstDFUWorkunit & dfuwu = result->getResult();
DFUstate state = (DFUstate)dfuwu.getState();
bool aborting = false;
Owned<IWorkUnit> wu = ctx->updateWorkUnit(); // may return NULL
if (wu.get()) { // if updatable (e.g. not hthor with no agent context)
Expand All @@ -645,11 +646,32 @@ static void blockUntilComplete(const char * label, IClientFileSpray &server, ICo
stat_type costFileAccess = money2cost_type(dfuwu.getFileAccessCost());
updateWorkunitStat(wu, SSTdfuworkunit, wuScope, StCostFileAccess, "", costFileAccess);
wu->setApplicationValue(label, dfuwu.getID(), dfuwu.getSummaryMessage(), true);
if (!isStartTimeRecorded)
{
switch (state)
{
case DFUstate_started:
case DFUstate_aborting:
case DFUstate_monitoring:
case DFUstate_aborted:
case DFUstate_failed:
case DFUstate_finished:

const char * whenStarted = dfuwu.getTimeStarted();
if (!isEmptyString(whenStarted))
{
CDateTime startedAt;
startedAt.setString(whenStarted);
updateWorkunitStat(wu, SSTdfuworkunit, wuScope, StWhenStarted, 0, startedAt.getTimeStamp());
isStartTimeRecorded = true;
}
break;
}
}
wu->commit();
wu.clear();
}

DFUstate state = (DFUstate)dfuwu.getState();
if (stateout)
stateout->clear().append(dfuwu.getStateMessage());
switch(state)
Expand Down

0 comments on commit aa773e3

Please sign in to comment.