Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion common/fileview2/fvdisksource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ bool TranslatedDiskDataSource::init()
bool TranslatedDiskDataSource::compileHelperWU()
{
submitWorkUnit(helperWuid, username, password);
return waitForWorkUnitToCompile(helperWuid);
WUState state = waitForWorkUnitToCompile(helperWuid);
return isCompiled(state);
}

//---------------------------------------------------------------------------
Expand Down
17 changes: 4 additions & 13 deletions common/workunit/workunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13182,25 +13182,16 @@ extern WORKUNIT_API WUState secWaitForWorkUnitToComplete(const char * wuid, ISec
return WUStateUnknown;
}

extern bool waitForWorkUnitToCompile(const char * wuid, int timeout)
extern WUState waitForWorkUnitToCompile(const char * wuid, int timeout)
{
switch(globalFactory->waitForWorkUnit(wuid, (unsigned) timeout, true, { WUStateWait }))
{
case WUStateCompiled:
case WUStateCompleted:
case WUStateWait:
case WUStateUploadingFiles:
return true;
default:
return false;
}
return globalFactory->waitForWorkUnit(wuid, (unsigned) timeout, true, { WUStateWait });
}

extern WORKUNIT_API bool secWaitForWorkUnitToCompile(const char *wuid, ISecManager *secmgr, ISecUser *secuser, int timeout)
extern WORKUNIT_API WUState secWaitForWorkUnitToCompile(const char *wuid, ISecManager *secmgr, ISecUser *secuser, int timeout)
{
if (checkWuSecAccess(wuid, secmgr, secuser, SecAccess_Read, "Wait for Compile", false, true))
return waitForWorkUnitToCompile(wuid, timeout);
return false;
return WUStateUnknown;
}

extern WORKUNIT_API bool secDebugWorkunit(const char *wuid, ISecManager *secmgr, ISecUser *secuser, const char *command, StringBuffer &response)
Expand Down
5 changes: 3 additions & 2 deletions common/workunit/workunit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1695,16 +1695,17 @@ inline bool isWorkunitDAToken(const char * distributedAccessToken)

//returns a state code. WUStateUnknown == timeout
extern WORKUNIT_API WUState waitForWorkUnitToComplete(const char * wuid, int timeout = -1, std::list<WUState> expectedStates = {});
extern WORKUNIT_API bool waitForWorkUnitToCompile(const char * wuid, int timeout = -1);
extern WORKUNIT_API WUState waitForWorkUnitToCompile(const char * wuid, int timeout = -1);
extern WORKUNIT_API WUState secWaitForWorkUnitToComplete(const char * wuid, ISecManager *secmgr, ISecUser *secuser, int timeout = -1, std::list<WUState> expectedStates = {});
extern WORKUNIT_API bool secWaitForWorkUnitToCompile(const char *wuid, ISecManager *secmgr, ISecUser *secuser, int timeout = -1);
extern WORKUNIT_API WUState secWaitForWorkUnitToCompile(const char *wuid, ISecManager *secmgr, ISecUser *secuser, int timeout = -1);
extern WORKUNIT_API bool secDebugWorkunit(const char *wuid, ISecManager *secmgr, ISecUser *secuser, const char *command, StringBuffer &response);
extern WORKUNIT_API WUState getWorkUnitState(const char* state);
extern WORKUNIT_API IWorkflowScheduleConnection * getWorkflowScheduleConnection(char const * wuid);
extern WORKUNIT_API const char *skipLeadingXml(const char *text);
extern WORKUNIT_API bool isArchiveQuery(const char * text);
extern WORKUNIT_API bool isQueryManifest(const char * text);
extern WORKUNIT_API IPropertyTree * resolveDefinitionInArchive(IPropertyTree * archive, const char * path);
inline bool isCompiled(WUState state) { return state == WUStateCompiled || state == WUStateCompleted; }

inline bool isLibrary(IConstWorkUnit * wu) { return wu->getApplicationValueInt("LibraryModule", "interfaceHash", 0) != 0; }

Expand Down
4 changes: 4 additions & 0 deletions ecl/eclcmd/eclcmd_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,10 @@ eclCmdOptionMatchIndicator EclCmdWithEclTarget::matchCommandLineOption(ArgvItera
return EclCmdOptionMatch;
if (iter.matchOption(optTargetCluster, ECLOPT_CLUSTER_DEPRECATED)||iter.matchOption(optTargetCluster, ECLOPT_CLUSTER_DEPRECATED_S))
return EclCmdOptionMatch;
if (iter.matchOption(optWaitTime, ECLOPT_WAIT))
return EclCmdOptionMatch;
if (iter.matchFlag(optPoll, ECLOPT_POLL))
return EclCmdOptionMatch;
//Process options which should be passed straight through to eclcc
StringBuffer temp;
if (iter.matchOptionText(temp, ECLOPT_FETCH_REPOS, true, false) || iter.matchOptionText(temp, ECLOPT_UPDATE_REPOS, true, false) ||
Expand Down
22 changes: 21 additions & 1 deletion ecl/eclcmd/eclcmd_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "ws_workunits.hpp"
#include "ws_fs.hpp"
#include "eclcc.hpp"
#include "workunit.hpp"

//=========================================================================================

Expand Down Expand Up @@ -311,6 +312,7 @@ class EclCmdCommon : implements IEclCommand, public CInterface
setRpcRequestTimeouts(rpc, waitMS, optWaitConnectMs, optWaitReadSec);
setRpcSSLOptions(rpc, optSSL, optClientCert, optClientPrivateKey, optCACert, optAcceptSelfSigned);
}
void checkFeatures(IClientWsWorkunits *client, bool &useCompression, int &major, int &minor, int &point, unsigned waitMs, unsigned waitConnectMs, unsigned waitReadSec);

virtual void usage()
{
Expand Down Expand Up @@ -359,14 +361,15 @@ class EclCmdCommon : implements IEclCommand, public CInterface
class EclCmdWithEclTarget : public EclCmdCommon
{
public:
EclCmdWithEclTarget() : optResultLimit((unsigned)-1), paramCount(0), optNoArchive(false), optLegacy(false), optDebug(false), optCheckDirty(false)
EclCmdWithEclTarget() : optResultLimit((unsigned)-1), paramCount(0), optWaitTime((unsigned)-1), optNoArchive(false), optLegacy(false), optDebug(false), optCheckDirty(false), optPoll(false)
{
}
virtual eclCmdOptionMatchIndicator matchCommandLineOption(ArgvIterator &iter, bool finalAttempt=false);
virtual bool finalizeOptions(IProperties *globals);
bool getFullAttributePath(StringBuffer & result);
bool setTarget(const char *target);
bool setParam(const char *in, bool final);
bool doDeploy(IClientWsWorkunits *client, unsigned waitMs, const char *cluster, const char *name, StringBuffer *wuid, StringBuffer *wucluster, bool noarchive, bool displayWuid, bool compress, bool protect);

virtual void usage()
{
Expand All @@ -380,6 +383,8 @@ class EclCmdWithEclTarget : public EclCmdCommon
" -f-<option>[=value] Set an eclcc command line option (single '-')\n"
" -f--<option>[=value] Set an eclcc command line option (double '-')\n"
" -Dname=value Override the definition of a global attribute 'name'\n"
" --wait=<ms> Max time to wait in milliseconds\n"
" --poll Poll for results, rather than remain connected\n"
" eclcc options (everything following):\n"
);
for (unsigned line=0; line < _elements_in(helpText); line++)
Expand Down Expand Up @@ -407,6 +412,19 @@ class EclCmdWithEclTarget : public EclCmdCommon
}
EclCmdCommon::usage();
}

protected:
int checkComplete(IClientWsWorkunits* client, IClientWUWaitRequest* req);
WUState checkCompiled(IClientWsWorkunits* client, IClientWUWaitRequest* req);
WUState pollForCompile(IClientWsWorkunits* client, const char *wuid, unsigned startTimeMs);

int getInitialRunWait()
{
if (!optPoll)
return optWaitTime;
return (optWaitTime < 10000) ? optWaitTime : 10000; //stay connected for the first 10 seconds even if polling
}

public:
StringAttr param;
StringAttr optTargetCluster;
Expand All @@ -424,12 +442,14 @@ class EclCmdWithEclTarget : public EclCmdCommon
IArrayOf<IEspNamedValue> definitions;
unsigned optResultLimit;
unsigned paramCount;
unsigned optWaitTime;
bool optNoArchive;
bool optLegacy;
bool optDebug;
bool optCheckDirty;
bool optFastSyntax = false;
bool optNoStdInc = false;
bool optPoll;
StringArray extraOptions;
};

Expand Down
Loading
Loading