workunit.hpp 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef WORKUNIT_INCL
  14. #define WORKUNIT_INCL
  15. #ifdef _WIN32
  16. #ifdef WORKUNIT_EXPORTS
  17. #define WORKUNIT_API __declspec(dllexport)
  18. #else
  19. #define WORKUNIT_API __declspec(dllimport)
  20. #endif
  21. #else
  22. #define WORKUNIT_API
  23. #endif
  24. #define MINIMUM_SCHEDULE_PRIORITY 0
  25. #define DEFAULT_SCHEDULE_PRIORITY 50
  26. #define MAXIMUM_SCHEDULE_PRIORITY 100
  27. #include "jiface.hpp"
  28. #include "errorlist.h"
  29. #include "jtime.hpp"
  30. #include "jsocket.hpp"
  31. #include "jstats.h"
  32. #include "jprop.hpp"
  33. #define GLOBAL_SCOPE "workunit"
  34. #define CHEAP_UCHAR_DEF
  35. #ifdef _WIN32
  36. typedef wchar_t UChar;
  37. #else //__WIN32
  38. typedef unsigned short UChar;
  39. #endif //__WIN32
  40. // error codes
  41. #define QUERRREG_ADD_NAMEDQUERY QUERYREGISTRY_ERROR_START
  42. #define QUERRREG_REMOVE_NAMEDQUERY QUERYREGISTRY_ERROR_START+1
  43. #define QUERRREG_WUID QUERYREGISTRY_ERROR_START+2
  44. #define QUERRREG_DLL QUERYREGISTRY_ERROR_START+3
  45. #define QUERRREG_SETALIAS QUERYREGISTRY_ERROR_START+4
  46. #define QUERRREG_RESOLVEALIAS QUERYREGISTRY_ERROR_START+5
  47. #define QUERRREG_REMOVEALIAS QUERYREGISTRY_ERROR_START+6
  48. #define QUERRREG_QUERY_REGISTRY QUERYREGISTRY_ERROR_START+7
  49. #define QUERRREG_SUSPEND QUERYREGISTRY_ERROR_START+8
  50. #define QUERRREG_UNSUSPEND QUERYREGISTRY_ERROR_START+9
  51. #define QUERRREG_COMMENT QUERYREGISTRY_ERROR_START+10
  52. class CDateTime;
  53. interface ISetToXmlTransformer;
  54. interface ISecManager;
  55. interface ISecUser;
  56. class StringArray;
  57. class StringBuffer;
  58. typedef unsigned __int64 __uint64;
  59. interface IScmIterator : extends IInterface
  60. {
  61. virtual bool first() = 0;
  62. virtual bool next() = 0;
  63. virtual bool isValid() = 0;
  64. };
  65. interface IQueueSwitcher : extends IInterface
  66. {
  67. virtual void * getQ(const char * qname, const char * wuid) = 0;
  68. virtual void putQ(const char * qname, const char * wuid, void * qitem) = 0;
  69. virtual bool isAuto() = 0;
  70. };
  71. //! PriorityClass
  72. //! Not sure what the real current class values are -- TBD
  73. enum WUPriorityClass
  74. {
  75. PriorityClassUnknown = 0,
  76. PriorityClassLow = 1,
  77. PriorityClassNormal = 2,
  78. PriorityClassHigh = 3,
  79. PriorityClassSize = 4
  80. };
  81. enum WUQueryType
  82. {
  83. QueryTypeUnknown = 0,
  84. QueryTypeEcl = 1,
  85. QueryTypeSql = 2,
  86. QueryTypeXml = 3,
  87. QueryTypeAttribute = 4,
  88. QueryTypeSize = 5
  89. };
  90. enum WUState
  91. {
  92. WUStateUnknown = 0,
  93. WUStateCompiled = 1,
  94. WUStateRunning = 2,
  95. WUStateCompleted = 3,
  96. WUStateFailed = 4,
  97. WUStateArchived = 5,
  98. WUStateAborting = 6,
  99. WUStateAborted = 7,
  100. WUStateBlocked = 8,
  101. WUStateSubmitted = 9,
  102. WUStateScheduled = 10,
  103. WUStateCompiling = 11,
  104. WUStateWait = 12,
  105. WUStateUploadingFiles = 13,
  106. WUStateDebugPaused = 14,
  107. WUStateDebugRunning = 15,
  108. WUStatePaused = 16,
  109. WUStateSize = 17
  110. };
  111. enum WUAction
  112. {
  113. WUActionUnknown = 0,
  114. WUActionCompile = 1,
  115. WUActionCheck = 2,
  116. WUActionRun = 3,
  117. WUActionExecuteExisting = 4,
  118. WUActionPause = 5,
  119. WUActionPauseNow = 6,
  120. WUActionResume = 7,
  121. WUActionSize = 8
  122. };
  123. enum WUResultStatus
  124. {
  125. ResultStatusUndefined = 0,
  126. ResultStatusCalculated = 1,
  127. ResultStatusSupplied = 2,
  128. ResultStatusFailed = 3,
  129. ResultStatusPartial = 4,
  130. ResultStatusSize = 5
  131. };
  132. enum WUExceptionSeverity
  133. {
  134. ExceptionSeverityInformation = 0,
  135. ExceptionSeverityWarning = 1,
  136. ExceptionSeverityError = 2,
  137. ExceptionSeverityAlert = 3,
  138. ExceptionSeveritySize = 4
  139. };
  140. //! IConstWUGraph
  141. enum WUGraphType
  142. {
  143. GraphTypeAny = 0,
  144. GraphTypeProgress = 1,
  145. GraphTypeEcl = 2,
  146. GraphTypeActivities = 3,
  147. GraphTypeSubProgress = 4,
  148. GraphTypeSize = 5
  149. };
  150. interface IConstWUGraphIterator;
  151. interface ICsvToRawTransformer;
  152. interface IXmlToRawTransformer;
  153. interface IPropertyTree;
  154. interface IPropertyTreeIterator;
  155. enum WUGraphState
  156. {
  157. WUGraphUnknown = 0,
  158. WUGraphComplete = 1,
  159. WUGraphRunning = 2,
  160. WUGraphFailed = 3,
  161. WUGraphPaused = 4
  162. };
  163. interface IConstWUGraphMeta : extends IInterface
  164. {
  165. virtual IStringVal & getName(IStringVal & ret) const = 0;
  166. virtual IStringVal & getLabel(IStringVal & ret) const = 0;
  167. virtual IStringVal & getTypeName(IStringVal & ret) const = 0;
  168. virtual WUGraphType getType() const = 0;
  169. virtual WUGraphState getState() const = 0;
  170. };
  171. interface IConstWUGraph : extends IConstWUGraphMeta
  172. {
  173. virtual IStringVal & getXGMML(IStringVal & ret, bool mergeProgress) const = 0;
  174. virtual IPropertyTree * getXGMMLTree(bool mergeProgress) const = 0;
  175. virtual IPropertyTree * getXGMMLTreeRaw() const = 0;
  176. };
  177. interface IWUGraph : extends IConstWUGraph
  178. {
  179. virtual void setXGMML(const char * text) = 0;
  180. virtual void setXGMMLTree(IPropertyTree * tree, bool compress=true) = 0;
  181. virtual void setName(const char * name) = 0;
  182. virtual void setLabel(const char * name) = 0;
  183. virtual void setType(WUGraphType type) = 0;
  184. };
  185. interface IConstWUGraphIterator : extends IScmIterator
  186. {
  187. virtual IConstWUGraph & query() = 0;
  188. };
  189. interface IConstWUTimer : extends IInterface
  190. {
  191. virtual IStringVal & getName(IStringVal & ret) const = 0;
  192. virtual unsigned getCount() const = 0;
  193. virtual unsigned getDuration() const = 0;
  194. };
  195. interface IWUTimer : extends IConstWUTimer
  196. {
  197. virtual void setName(const char * str) = 0;
  198. virtual void setCount(unsigned c) = 0;
  199. virtual void setDuration(unsigned d) = 0;
  200. };
  201. interface IConstWUTimerIterator : extends IScmIterator
  202. {
  203. virtual IConstWUTimer & query() = 0;
  204. };
  205. interface IConstWUGraphMetaIterator : extends IScmIterator
  206. {
  207. virtual IConstWUGraphMeta & query() = 0;
  208. };
  209. //! IWUResult
  210. enum
  211. {
  212. ResultSequenceStored = -1,
  213. ResultSequencePersist = -2,
  214. ResultSequenceInternal = -3,
  215. ResultSequenceOnce = -4,
  216. };
  217. extern WORKUNIT_API bool isSpecialResultSequence(unsigned sequence);
  218. enum WUResultFormat
  219. {
  220. ResultFormatRaw = 0,
  221. ResultFormatXml = 1,
  222. ResultFormatXmlSet = 2,
  223. ResultFormatCsv = 3,
  224. ResultFormatSize = 4
  225. };
  226. interface IConstWUResult : extends IInterface
  227. {
  228. virtual WUResultStatus getResultStatus() const = 0;
  229. virtual IStringVal & getResultName(IStringVal & str) const = 0;
  230. virtual int getResultSequence() const = 0;
  231. virtual bool isResultScalar() const = 0;
  232. virtual IStringVal & getResultXml(IStringVal & str) const = 0;
  233. virtual unsigned getResultFetchSize() const = 0;
  234. virtual __int64 getResultTotalRowCount() const = 0;
  235. virtual __int64 getResultRowCount() const = 0;
  236. virtual void getResultDataset(IStringVal & ecl, IStringVal & defs) const = 0;
  237. virtual IStringVal & getResultLogicalName(IStringVal & ecl) const = 0;
  238. virtual IStringVal & getResultKeyField(IStringVal & ecl) const = 0;
  239. virtual unsigned getResultRequestedRows() const = 0;
  240. virtual __int64 getResultInt() const = 0;
  241. virtual bool getResultBool() const = 0;
  242. virtual double getResultReal() const = 0;
  243. virtual IStringVal & getResultString(IStringVal & str) const = 0;
  244. virtual IDataVal & getResultRaw(IDataVal & data, IXmlToRawTransformer * xmlTransformer, ICsvToRawTransformer * csvTransformer) const = 0;
  245. virtual IDataVal & getResultUnicode(IDataVal & data) const = 0;
  246. virtual IStringVal & getResultEclSchema(IStringVal & str) const = 0;
  247. virtual __int64 getResultRawSize(IXmlToRawTransformer * xmlTransformer, ICsvToRawTransformer * csvTransformer) const = 0;
  248. virtual IDataVal & getResultRaw(IDataVal & data, __int64 from, __int64 length, IXmlToRawTransformer * xmlTransformer, ICsvToRawTransformer * csvTransformer) const = 0;
  249. virtual IStringVal & getResultRecordSizeEntry(IStringVal & str) const = 0;
  250. virtual IStringVal & getResultTransformerEntry(IStringVal & str) const = 0;
  251. virtual __int64 getResultRowLimit() const = 0;
  252. virtual IStringVal & getResultFilename(IStringVal & str) const = 0;
  253. virtual WUResultFormat getResultFormat() const = 0;
  254. virtual unsigned getResultHash() const = 0;
  255. virtual void getResultDecimal(void * val, unsigned length, unsigned precision, bool isSigned) const = 0;
  256. virtual bool getResultIsAll() const = 0;
  257. virtual const IProperties *queryResultXmlns() = 0;
  258. };
  259. interface IWUResult : extends IConstWUResult
  260. {
  261. virtual void setResultStatus(WUResultStatus status) = 0;
  262. virtual void setResultName(const char * name) = 0;
  263. virtual void setResultSequence(unsigned seq) = 0;
  264. virtual void setResultSchemaRaw(unsigned len, const void * schema) = 0;
  265. virtual void setResultScalar(bool isScalar) = 0;
  266. virtual void setResultRaw(unsigned len, const void * data, WUResultFormat format) = 0;
  267. virtual void setResultFetchSize(unsigned rows) = 0;
  268. virtual void setResultTotalRowCount(__int64 rows) = 0;
  269. virtual void setResultRowCount(__int64 rows) = 0;
  270. virtual void setResultDataset(const char * ecl, const char * defs) = 0;
  271. virtual void setResultLogicalName(const char * logicalName) = 0;
  272. virtual void setResultKeyField(const char * name) = 0;
  273. virtual void setResultRequestedRows(unsigned rowcount) = 0;
  274. virtual void setResultInt(__int64 val) = 0;
  275. virtual void setResultBool(bool val) = 0;
  276. virtual void setResultReal(double val) = 0;
  277. virtual void setResultString(const char * val, unsigned length) = 0;
  278. virtual void setResultData(const void * val, unsigned length) = 0;
  279. virtual void setResultDecimal(const void * val, unsigned length) = 0;
  280. virtual void addResultRaw(unsigned len, const void * data, WUResultFormat format) = 0;
  281. virtual void setResultRecordSizeEntry(const char * val) = 0;
  282. virtual void setResultTransformerEntry(const char * val) = 0;
  283. virtual void setResultRowLimit(__int64 value) = 0;
  284. virtual void setResultFilename(const char * name) = 0;
  285. virtual void setResultUnicode(const void * val, unsigned length) = 0;
  286. virtual void setResultUInt(__uint64 val) = 0;
  287. virtual void setResultIsAll(bool value) = 0;
  288. virtual void setResultFormat(WUResultFormat format) = 0;
  289. virtual void setResultXML(const char * xml) = 0;
  290. virtual void setResultRow(unsigned len, const void * data) = 0;
  291. virtual void setResultXmlns(const char *prefix, const char *uri) = 0;
  292. };
  293. interface IConstWUResultIterator : extends IScmIterator
  294. {
  295. virtual IConstWUResult & query() = 0;
  296. };
  297. //! IWUQuery
  298. enum WUFileType
  299. {
  300. FileTypeCpp = 0,
  301. FileTypeDll = 1,
  302. FileTypeResText = 2,
  303. FileTypeHintXml = 3,
  304. FileTypeXml = 4,
  305. FileTypeSize = 5
  306. };
  307. interface IConstWUAssociatedFile : extends IInterface
  308. {
  309. virtual WUFileType getType() const = 0;
  310. virtual IStringVal & getDescription(IStringVal & ret) const = 0;
  311. virtual IStringVal & getIp(IStringVal & ret) const = 0;
  312. virtual IStringVal & getName(IStringVal & ret) const = 0;
  313. virtual IStringVal & getNameTail(IStringVal & ret) const = 0;
  314. virtual unsigned getCrc() const = 0;
  315. };
  316. interface IConstWUAssociatedFileIterator : extends IScmIterator
  317. {
  318. virtual IConstWUAssociatedFile & query() = 0;
  319. };
  320. interface IConstWUQuery : extends IInterface
  321. {
  322. virtual WUQueryType getQueryType() const = 0;
  323. virtual IStringVal & getQueryText(IStringVal & str) const = 0;
  324. virtual IStringVal & getQueryName(IStringVal & str) const = 0;
  325. virtual IStringVal & getQueryDllName(IStringVal & str) const = 0;
  326. virtual unsigned getQueryDllCrc() const = 0;
  327. virtual IStringVal & getQueryCppName(IStringVal & str) const = 0;
  328. virtual IStringVal & getQueryResTxtName(IStringVal & str) const = 0;
  329. virtual IConstWUAssociatedFile * getAssociatedFile(WUFileType type, unsigned index) const = 0;
  330. virtual IConstWUAssociatedFileIterator & getAssociatedFiles() const = 0;
  331. virtual IStringVal & getQueryShortText(IStringVal & str) const = 0;
  332. virtual IStringVal & getQueryMainDefinition(IStringVal & str) const = 0;
  333. };
  334. interface IWUQuery : extends IConstWUQuery
  335. {
  336. virtual void setQueryType(WUQueryType qt) = 0;
  337. virtual void setQueryText(const char * pstr) = 0;
  338. virtual void setQueryName(const char * pstr) = 0;
  339. virtual void addAssociatedFile(WUFileType type, const char * name, const char * ip, const char * desc, unsigned crc) = 0;
  340. virtual void removeAssociatedFiles() = 0;
  341. virtual void setQueryMainDefinition(const char * str) = 0;
  342. };
  343. interface IConstWUWebServicesInfo : extends IInterface
  344. {
  345. virtual IStringVal & getModuleName(IStringVal & str) const = 0;
  346. virtual IStringVal & getAttributeName(IStringVal & str) const = 0;
  347. virtual IStringVal & getDefaultName(IStringVal & str) const = 0;
  348. virtual IStringVal & getInfo(const char * name, IStringVal & str) const = 0;
  349. virtual unsigned getWebServicesCRC() const = 0;
  350. };
  351. interface IWUWebServicesInfo : extends IConstWUWebServicesInfo
  352. {
  353. virtual void setModuleName(const char * pstr) = 0;
  354. virtual void setAttributeName(const char * pstr) = 0;
  355. virtual void setDefaultName(const char * pstr) = 0;
  356. virtual void setInfo(const char * name, const char * info) = 0;
  357. virtual void setWebServicesCRC(unsigned crc) = 0;
  358. };
  359. interface IConstWURoxieQueryInfo : extends IInterface
  360. {
  361. virtual IStringVal & getQueryInfo(IStringVal & str) const = 0;
  362. virtual IStringVal & getDefaultPackageInfo(IStringVal & str) const = 0;
  363. virtual IStringVal & getRoxieClusterName(IStringVal & str) const = 0;
  364. virtual IStringVal & getWuid(IStringVal & str) const = 0;
  365. };
  366. interface IWURoxieQueryInfo : extends IConstWURoxieQueryInfo
  367. {
  368. virtual void setQueryInfo(const char * info) = 0;
  369. virtual void setDefaultPackageInfo(const char * pstr, int len) = 0;
  370. virtual void setRoxieClusterName(const char * name) = 0;
  371. virtual void setWuid(const char * wuid) = 0;
  372. };
  373. //! IWUPlugin
  374. interface IConstWUPlugin : extends IInterface
  375. {
  376. virtual IStringVal & getPluginName(IStringVal & str) const = 0;
  377. virtual IStringVal & getPluginVersion(IStringVal & str) const = 0;
  378. };
  379. interface IWUPlugin : extends IConstWUPlugin
  380. {
  381. virtual void setPluginName(const char * str) = 0;
  382. virtual void setPluginVersion(const char * str) = 0;
  383. };
  384. interface IConstWUPluginIterator : extends IScmIterator
  385. {
  386. virtual IConstWUPlugin & query() = 0;
  387. };
  388. interface IConstWULibrary : extends IInterface
  389. {
  390. virtual IStringVal & getName(IStringVal & str) const = 0;
  391. };
  392. interface IWULibrary : extends IConstWULibrary
  393. {
  394. virtual void setName(const char * str) = 0;
  395. };
  396. interface IConstWULibraryIterator : extends IScmIterator
  397. {
  398. virtual IConstWULibrary & query() = 0;
  399. };
  400. //! IWUException
  401. interface IConstWUException : extends IInterface
  402. {
  403. virtual IStringVal & getExceptionSource(IStringVal & str) const = 0;
  404. virtual IStringVal & getExceptionMessage(IStringVal & str) const = 0;
  405. virtual unsigned getExceptionCode() const = 0;
  406. virtual WUExceptionSeverity getSeverity() const = 0;
  407. virtual IStringVal & getTimeStamp(IStringVal & dt) const = 0;
  408. virtual IStringVal & getExceptionFileName(IStringVal & str) const = 0;
  409. virtual unsigned getExceptionLineNo() const = 0;
  410. virtual unsigned getExceptionColumn() const = 0;
  411. };
  412. interface IWUException : extends IConstWUException
  413. {
  414. virtual void setExceptionSource(const char * str) = 0;
  415. virtual void setExceptionMessage(const char * str) = 0;
  416. virtual void setExceptionCode(unsigned code) = 0;
  417. virtual void setSeverity(WUExceptionSeverity level) = 0;
  418. virtual void setTimeStamp(const char * dt) = 0;
  419. virtual void setExceptionFileName(const char * str) = 0;
  420. virtual void setExceptionLineNo(unsigned r) = 0;
  421. virtual void setExceptionColumn(unsigned c) = 0;
  422. };
  423. interface IConstWUExceptionIterator : extends IScmIterator
  424. {
  425. virtual IConstWUException & query() = 0;
  426. };
  427. enum ClusterType { NoCluster, HThorCluster, RoxieCluster, ThorLCRCluster };
  428. extern WORKUNIT_API ClusterType getClusterType(const char * platform, ClusterType dft = NoCluster);
  429. extern WORKUNIT_API const char *clusterTypeString(ClusterType clusterType, bool lcrSensitive);
  430. inline bool isThorCluster(ClusterType type) { return (type == ThorLCRCluster); }
  431. //! IClusterInfo
  432. interface IConstWUClusterInfo : extends IInterface
  433. {
  434. virtual IStringVal & getName(IStringVal & str) const = 0;
  435. virtual IStringVal & getScope(IStringVal & str) const = 0;
  436. virtual IStringVal & getThorQueue(IStringVal & str) const = 0;
  437. virtual unsigned getSize() const = 0;
  438. virtual ClusterType getPlatform() const = 0;
  439. virtual IStringVal & getAgentQueue(IStringVal & str) const = 0;
  440. virtual IStringVal & getServerQueue(IStringVal & str) const = 0;
  441. virtual IStringVal & getRoxieProcess(IStringVal & str) const = 0;
  442. virtual const StringArray & getThorProcesses() const = 0;
  443. virtual const StringArray & getPrimaryThorProcesses() const = 0;
  444. virtual const SocketEndpointArray & getRoxieServers() const = 0;
  445. virtual const char *getLdapUser() const = 0;
  446. virtual const char *getLdapPassword() const = 0;
  447. };
  448. //! IWorkflowItem
  449. enum WFType
  450. {
  451. WFTypeNormal = 0,
  452. WFTypeSuccess = 1,
  453. WFTypeFailure = 2,
  454. WFTypeRecovery = 3,
  455. WFTypeWait = 4,
  456. WFTypeSize = 5
  457. };
  458. enum WFMode
  459. {
  460. WFModeNormal = 0,
  461. WFModeCondition = 1,
  462. WFModeSequential = 2,
  463. WFModeParallel = 3,
  464. WFModePersist = 4,
  465. WFModeBeginWait = 5,
  466. WFModeWait = 6,
  467. WFModeOnce = 7,
  468. WFModeSize = 8
  469. };
  470. enum WFState
  471. {
  472. WFStateNull = 0,
  473. WFStateReqd = 1,
  474. WFStateDone = 2,
  475. WFStateFail = 3,
  476. WFStateSkip = 4,
  477. WFStateWait = 5,
  478. WFStateBlocked = 6,
  479. WFStateSize = 7
  480. };
  481. interface IWorkflowDependencyIterator : extends IScmIterator
  482. {
  483. virtual unsigned query() const = 0;
  484. };
  485. interface IWorkflowEvent : extends IInterface
  486. {
  487. virtual const char * queryName() const = 0;
  488. virtual const char * queryText() const = 0;
  489. virtual bool matches(const char * name, const char * text) const = 0;
  490. };
  491. interface IConstWorkflowItem : extends IInterface
  492. {
  493. virtual unsigned queryWfid() const = 0;
  494. virtual bool isScheduled() const = 0;
  495. virtual bool isScheduledNow() const = 0;
  496. virtual IWorkflowEvent * getScheduleEvent() const = 0;
  497. virtual unsigned querySchedulePriority() const = 0;
  498. virtual bool hasScheduleCount() const = 0;
  499. virtual unsigned queryScheduleCount() const = 0;
  500. virtual IWorkflowDependencyIterator * getDependencies() const = 0;
  501. virtual WFType queryType() const = 0;
  502. virtual WFMode queryMode() const = 0;
  503. virtual unsigned querySuccess() const = 0;
  504. virtual unsigned queryFailure() const = 0;
  505. virtual unsigned queryRecovery() const = 0;
  506. virtual unsigned queryRetriesAllowed() const = 0;
  507. virtual unsigned queryContingencyFor() const = 0;
  508. virtual IStringVal & getPersistName(IStringVal & val) const = 0;
  509. virtual unsigned queryPersistWfid() const = 0;
  510. virtual int queryPersistCopies() const = 0; // 0 - unmangled name, < 0 - use default, > 0 - max number
  511. virtual unsigned queryScheduleCountRemaining() const = 0;
  512. virtual WFState queryState() const = 0;
  513. virtual unsigned queryRetriesRemaining() const = 0;
  514. virtual int queryFailCode() const = 0;
  515. virtual const char * queryFailMessage() const = 0;
  516. virtual const char * queryEventName() const = 0;
  517. virtual const char * queryEventExtra() const = 0;
  518. virtual unsigned queryScheduledWfid() const = 0;
  519. virtual IStringVal & queryCluster(IStringVal & val) const = 0;
  520. };
  521. inline bool isPersist(const IConstWorkflowItem & item) { return item.queryMode() == WFModePersist; }
  522. interface IRuntimeWorkflowItem : extends IConstWorkflowItem
  523. {
  524. virtual void setState(WFState state) = 0;
  525. virtual bool testAndDecRetries() = 0;
  526. virtual bool decAndTestScheduleCountRemaining() = 0;
  527. virtual void setFailInfo(int code, const char * message) = 0;
  528. virtual void reset() = 0;
  529. virtual void setEvent(const char * name, const char * extra) = 0;
  530. virtual void incScheduleCount() = 0;
  531. };
  532. interface IWorkflowItem : extends IRuntimeWorkflowItem
  533. {
  534. virtual void setScheduledNow() = 0;
  535. virtual void setScheduledOn(const char * name, const char * text) = 0;
  536. virtual void setSchedulePriority(unsigned priority) = 0;
  537. virtual void setScheduleCount(unsigned count) = 0;
  538. virtual void addDependency(unsigned wfid) = 0;
  539. virtual void setPersistInfo(const char * name, unsigned wfid, int maxCopies) = 0;
  540. virtual void syncRuntimeData(const IConstWorkflowItem & other) = 0;
  541. virtual void setScheduledWfid(unsigned wfid) = 0;
  542. virtual void setCluster(const char * cluster) = 0;
  543. };
  544. interface IConstWorkflowItemIterator : extends IScmIterator
  545. {
  546. virtual IConstWorkflowItem * query() const = 0;
  547. };
  548. interface IRuntimeWorkflowItemIterator : extends IConstWorkflowItemIterator
  549. {
  550. virtual IRuntimeWorkflowItem * get() const = 0;
  551. };
  552. interface IWorkflowItemIterator : extends IConstWorkflowItemIterator
  553. {
  554. virtual IWorkflowItem * get() const = 0;
  555. };
  556. interface IWorkflowItemArray : extends IInterface
  557. {
  558. virtual IRuntimeWorkflowItem & queryWfid(unsigned wfid) = 0;
  559. virtual unsigned count() const = 0;
  560. virtual IRuntimeWorkflowItemIterator * getSequenceIterator() = 0;
  561. virtual void addClone(const IConstWorkflowItem * other) = 0;
  562. virtual bool hasScheduling() const = 0;
  563. };
  564. enum LocalFileUploadType
  565. {
  566. UploadTypeFileSpray = 0,
  567. UploadTypeWUResult = 1,
  568. UploadTypeWUResultCsv = 2,
  569. UploadTypeWUResultXml = 3,
  570. UploadTypeSize = 4
  571. };
  572. interface IConstLocalFileUpload : extends IInterface
  573. {
  574. virtual unsigned queryID() const = 0;
  575. virtual LocalFileUploadType queryType() const = 0;
  576. virtual IStringVal & getSource(IStringVal & ret) const = 0;
  577. virtual IStringVal & getDestination(IStringVal & ret) const = 0;
  578. virtual IStringVal & getEventTag(IStringVal & ret) const = 0;
  579. };
  580. interface IConstLocalFileUploadIterator : extends IScmIterator
  581. {
  582. virtual IConstLocalFileUpload * get() = 0;
  583. };
  584. enum WUSubscribeOptions
  585. {
  586. SubscribeOptionRunningState = 0,
  587. SubscribeOptionAnyState = 1,
  588. SubscribeOptionAbort = 2,
  589. SubscribeOptionProgress = 3,
  590. SubscribeOptionAll = 4,
  591. SubscribeOptionSize = 5
  592. };
  593. interface IWUGraphProgress;
  594. interface IPropertyTree;
  595. enum WUFileKind
  596. {
  597. WUFileStandard = 0,
  598. WUFileTemporary = 1,
  599. WUFileOwned = 2,
  600. WUFileJobOwned = 3
  601. };
  602. typedef unsigned __int64 WUGraphIDType;
  603. typedef unsigned __int64 WUNodeIDType;
  604. interface IWUGraphProgress;
  605. interface IWUGraphStats;
  606. interface IPropertyTree;
  607. interface IConstWUGraphProgress : extends IInterface
  608. {
  609. virtual IPropertyTree * getProgressTree() = 0;
  610. virtual WUGraphState queryGraphState() = 0;
  611. virtual WUGraphState queryNodeState(WUGraphIDType nodeId) = 0;
  612. virtual IWUGraphProgress * update() = 0;
  613. virtual IWUGraphStats * update(StatisticCreatorType creatorType, const char * creator, unsigned subgraph) = 0;
  614. virtual unsigned queryFormatVersion() = 0;
  615. };
  616. interface IWUGraphStats : public IInterface
  617. {
  618. virtual IStatisticGatherer & queryStatsBuilder() = 0;
  619. };
  620. interface IWUGraphProgress : extends IConstWUGraphProgress
  621. {
  622. virtual void setGraphState(WUGraphState state) = 0;
  623. virtual void setNodeState(WUGraphIDType nodeId, WUGraphState state) = 0;
  624. };
  625. interface IConstWUTimeStamp : extends IInterface
  626. {
  627. virtual IStringVal & getApplication(IStringVal & str) const = 0;
  628. virtual IStringVal & getEvent(IStringVal & str) const = 0;
  629. virtual IStringVal & getDate(IStringVal & dt) const = 0;
  630. };
  631. interface IConstWUTimeStampIterator : extends IScmIterator
  632. {
  633. virtual IConstWUTimeStamp & query() = 0;
  634. };
  635. interface IConstWUAppValue : extends IInterface
  636. {
  637. virtual IStringVal & getApplication(IStringVal & str) const = 0;
  638. virtual IStringVal & getName(IStringVal & str) const = 0;
  639. virtual IStringVal & getValue(IStringVal & str) const = 0;
  640. };
  641. interface IConstWUAppValueIterator : extends IScmIterator
  642. {
  643. virtual IConstWUAppValue & query() = 0;
  644. };
  645. //More: Counts on files? optional target?
  646. /*
  647. * Statistics are used to store timestamps, time periods, counts memory usage and any other interesting statistic
  648. * which is collected as the query is built or executed.
  649. *
  650. * Each statistic has the following details:
  651. *
  652. * Creator - Which component created the statistic. This should be the name of the component instance i.e., "mythor_x_y" rather than the type ("thor").
  653. * - It can also be used to represent a subcomponent e.g., mythor:0 the master, mythor:10 means the 10th slave.
  654. * ?? Is the sub component always numeric ??
  655. *
  656. * Kind - The specific kind of the statistic - uses a global enumeration. (Engines can locally use different ranges of numbers and map them to the global enumeration).
  657. *
  658. * Measure - What kind of statistic is it? It can always be derived from the kind. The following values are supported:
  659. * time - elapsed time in nanoseconds
  660. * timestamp/when - a point in time (?to the nanosecond?)
  661. * count - a count of the number of occurrences
  662. * memory/size - a quantity of memory (or disk) measured in kb
  663. * load - measure of cpu activity (stored as 1/1000000 core)
  664. * skew - a measure of skew. 10000 = perfectly balanced, range [0..infinity]
  665. *
  666. *Optional:
  667. *
  668. * Description - Purely for display, calculated if not explicitly supplied.
  669. * Scope - Where in the execution of the task is statistic gathered? It can have multiple levels (separated by colons), and statistics for
  670. * a given level can be retrieved independently. The following scopes are supported:
  671. * "global" - the default if not specified. Globally/within a workunit.
  672. * "wfid<n>" - within workflow item <n> (is this at all useful?)
  673. * "graphn[:sg<n>[:ac<n>"]"
  674. * Possibly additional levels to allow multiple instances of an activity when used in a graph etc.
  675. *
  676. * Target - The target of the thing being monitored. E.g., a filename. ?? Is this needed? Should this be combined with scope??
  677. *
  678. * Examples:
  679. * creator(mythor),scope(),kind(TimeWall) total time spend processing in thor search ct(thor),scope(),kind(TimeWall)
  680. * creator(mythor),scope(graph1),kind(TimeWall) - total time spent processing a graph
  681. * creator(mythor),scope(graph1:sg<subid>),kind(TimeElapsed) - total time spent processing a subgraph
  682. * creator(mythor),scope(graph1:sg<n>:ac<id>),kind(TimeElapsed) - time for activity from start to stop
  683. * creator(mythor),scope(graph1:sg<n>:ac<id>),kind(TimeLocal) - time spent locally processing
  684. * creator(mythor),scope(graph1:sg<n>:ac<id>),kind(TimeWallRowRange) - time from first row to last row
  685. * creator(mythor),scope(graph1:sg<n>:ac<id>),kind(WhenFirstRow) - timestamp for first row
  686. * creator(myeclccserver@myip),scope(compile),kind(TimeWall)
  687. * creator(myeclccserver@myip),scope(compile:transform),kind(TimeWall)
  688. * creator(myeclccserver@myip),scope(compile:transform:fold),kind(TimeWall)
  689. *
  690. * Other possibilities
  691. * creator(myesp),scope(filefile::abc::def),kind(NumAccesses)
  692. *
  693. * Configuring statistic collection:
  694. * - Each engine allows the statistics being collected to be specified. You need to configure the area (time/memory/disk/), the level of detail by component and location.
  695. *
  696. * Some background notes:
  697. * - Start time and end time (time processing first and last record) is useful for detecting time skew/serial activities.
  698. * - Information is lost if you only show final skew, rather than skew over time, but storing time series data is
  699. * prohibitive so we may need to create some derived metrics.
  700. * - The engines need options to control what information is gathered.
  701. * - Need to ensure clocks are synchronized for the timestamps to be useful.
  702. *
  703. * Some typical analysis we want to perform:
  704. * - Activities that show significant skew between first (or last) record times between nodes.
  705. * - Activities where the majority of the time is being spent.
  706. *
  707. * Filtering statistics - with control over who is creating it, what is being recorded, and
  708. * [in order of importance]
  709. * - which level of creator you are interested in [summary or individual nodes, or both] (*;*:*)?
  710. * - which level of scope (interested in activities, or just by graph, or both)
  711. * - a particular kind of statistic
  712. * - A particular creator (including fixed/wildcarded sub-component)
  713. *
  714. * => Provide a class for representing a filter, which can be used to filter when recording and retrieving. Start simple and then extend.
  715. * Text representation creator(*,*:*),creatordepth(n),creatorkind(x),scopedepth(n),scopekind(xxx,yyy),scope(*:23),kind(x).
  716. *
  717. * Examples
  718. * kind(TimeElapsed),scopetype(subgraph) - subgraph timings
  719. * kind(Time*),scopedepth(1)&kind(TimeElapsed),scopedepth(2),scopetype(subgraph) - all legacy global timings.
  720. * creatortype(thor),kind(TimeElapsed),scope("") - how much time has been spent on thor? (Need to sum?)
  721. * creator(mythor),kind(TimeElapsed),scope("") - how much time has been spent on *this* thor.
  722. * kind(TimeElapsed),scope("compiled") - how much time has been spent on *this* thor.
  723. *
  724. * Need to efficiently
  725. * - Get all (simple) stats for a graph/activities (creator(*),kind(*),scope(x:*)) - display in graph, finding hotspots
  726. * - Get all stats for an activity (creator(*:*),measure(*:*),scope(x:y)) - providing details in a graph
  727. * - Merge stats from multiple components
  728. * - Merge stats from multiple runs?
  729. *
  730. * Bulk updates will tend to be for a given component and should only need minor processing (e.g. patch ids) or no processing to update/combine.
  731. * - You need to be able to filter only a certain level of statistic - e.g., times for transforms, but not details of those transforms.
  732. *
  733. * => suggest store as
  734. * stats[creatorDepth,scopeDepth][creator] { kind, scope, value, target }. sorted by (scope, target, kind)
  735. * - allows high level filtering by level
  736. * - allows combining with minor updates.
  737. * - possibly extra structure within each creator - maybe depending on the level of the scope
  738. * - need to be sub-sorted to allow efficient merging between creators (e.g. for calculating skew)
  739. * - possibly different structure when collecting [e.g., indexed by stat, or using a local stat mapping ] and storing.
  740. *
  741. * Use (local) tables to map scope->uid. Possibly implicitly defined on first occurrence, or zip the entire structure.
  742. *
  743. * The progress information should be stored compressed, with min,max child ids to avoid decompressing
  744. */
  745. // Should the statistics classes be able to be stored globally e.g., for esp and other non workunit contexts?
  746. /*
  747. * Work out how to represent all of the existing statistics
  748. *
  749. * Counts of number of skips on an index: kind(CountIndexSkips),measure(count),scope(workunit | filename | graph:activity#)
  750. * Activity start time kind(WhenStart),measure(timestamp),scope(graph:activity#),creator(mythor)
  751. * kind(WhenFirstRow),measure(timestamp),scope(graph:activity#),creator(mythor:slave#)
  752. * Number of times files accessed by esp: kind(CountFileAccess),measure(count),scope(),target(filename);
  753. * Elapsed/remaining time for sprays:
  754. */
  755. /*
  756. * Statistics and their kinds - prefixed indicates their type. Note generally the same type won't be reused for two different things.
  757. *
  758. * TimeStamps:
  759. * StWhenGraphStart - When a graph starts
  760. * StWhenFirstRow - When the first row is processed by slave activity
  761. *
  762. * Time
  763. * StTimeParseQuery
  764. * StTimeTransformQuery
  765. * StTimeTransformQuery_Fold - transformquery:fold? effectively an extra level of detail on the kind.
  766. * StTimeTransformQuery_Normalize
  767. * StTimeElapsedExecuting - Elapsed wall time between first row and last row.
  768. * StTimeExecuting - Cpu time spent executing
  769. *
  770. *
  771. * Memory
  772. * StSizeGeneratedCpp
  773. * StSizePeakMemory
  774. *
  775. * Count
  776. * StCountIndexSeeks
  777. * StCountIndexScans
  778. *
  779. * Load
  780. * StLoadWhileSorting - Average load while processing a sort?
  781. *
  782. * Skew
  783. * StSkewRecordDistribution - Skew on the records across the different nodes
  784. * StSkewExecutionTime - Skew in the execution time between activities.
  785. *
  786. */
  787. interface IConstWUStatistic : extends IInterface
  788. {
  789. virtual IStringVal & getDescription(IStringVal & str, bool createDefault) const = 0; // Description of the statistic suitable for displaying to the user
  790. virtual IStringVal & getCreator(IStringVal & str) const = 0; // what component gathered the statistic e.g., myroxie/eclserver_12/mythor:100
  791. virtual IStringVal & getScope(IStringVal & str) const = 0; // what scope is the statistic gathered over? e.g., workunit, wfid:n, graphn, graphn:m
  792. virtual IStringVal & getFormattedValue(IStringVal & str) const = 0; // The formatted value for display
  793. virtual StatisticMeasure getMeasure() const = 0;
  794. virtual StatisticKind getKind() const = 0;
  795. virtual StatisticCreatorType getCreatorType() const = 0;
  796. virtual StatisticScopeType getScopeType() const = 0;
  797. virtual unsigned __int64 getValue() const = 0;
  798. virtual unsigned __int64 getCount() const = 0;
  799. virtual unsigned __int64 getMax() const = 0;
  800. virtual unsigned __int64 getTimestamp() const = 0; // time the statistic was created
  801. virtual bool matches(const IStatisticsFilter * filter) const = 0;
  802. };
  803. interface IConstWUStatisticIterator : extends IScmIterator
  804. {
  805. virtual IConstWUStatistic & query() = 0;
  806. };
  807. //! IWorkUnit
  808. //! Provides high level access to WorkUnit "header" data.
  809. interface IWorkUnit;
  810. interface IUserDescriptor;
  811. interface IStringIterator : extends IScmIterator
  812. {
  813. virtual IStringVal & str(IStringVal & str) = 0;
  814. };
  815. interface IConstWorkUnit : extends IInterface
  816. {
  817. virtual bool aborting() const = 0;
  818. virtual void forceReload() = 0;
  819. virtual WUAction getAction() const = 0;
  820. virtual IStringVal& getActionEx(IStringVal & str) const = 0;
  821. virtual IStringVal & getApplicationValue(const char * application, const char * propname, IStringVal & str) const = 0;
  822. virtual int getApplicationValueInt(const char * application, const char * propname, int defVal) const = 0;
  823. virtual IConstWUAppValueIterator & getApplicationValues() const = 0;
  824. virtual bool hasWorkflow() const = 0;
  825. virtual unsigned queryEventScheduledCount() const = 0;
  826. virtual IPropertyTree * queryWorkflowTree() const = 0;
  827. virtual IConstWorkflowItemIterator * getWorkflowItems() const = 0;
  828. virtual IWorkflowItemArray * getWorkflowClone() const = 0;
  829. virtual IConstLocalFileUploadIterator * getLocalFileUploads() const = 0;
  830. virtual bool requiresLocalFileUpload() const = 0;
  831. virtual bool getIsQueryService() const = 0;
  832. virtual IStringVal & getClusterName(IStringVal & str) const = 0;
  833. virtual bool hasDebugValue(const char * propname) const = 0;
  834. virtual IStringVal & getDebugValue(const char * propname, IStringVal & str) const = 0;
  835. virtual int getDebugValueInt(const char * propname, int defVal) const = 0;
  836. virtual __int64 getDebugValueInt64(const char * propname, __int64 defVal) const = 0;
  837. virtual bool getDebugValueBool(const char * propname, bool defVal) const = 0;
  838. virtual IStringIterator & getDebugValues() const = 0;
  839. virtual IStringIterator & getDebugValues(const char * prop) const = 0;
  840. virtual unsigned getExceptionCount() const = 0;
  841. virtual IConstWUExceptionIterator & getExceptions() const = 0;
  842. virtual IConstWUResult * getGlobalByName(const char * name) const = 0;
  843. virtual IConstWUGraphMetaIterator & getGraphsMeta(WUGraphType type) const = 0;
  844. virtual IConstWUGraphIterator & getGraphs(WUGraphType type) const = 0;
  845. virtual IConstWUGraph * getGraph(const char * name) const = 0;
  846. virtual IConstWUGraphProgress * getGraphProgress(const char * name) const = 0;
  847. virtual IStringVal & getJobName(IStringVal & str) const = 0;
  848. virtual IConstWUPlugin * getPluginByName(const char * name) const = 0;
  849. virtual IConstWUPluginIterator & getPlugins() const = 0;
  850. virtual IConstWULibraryIterator & getLibraries() const = 0;
  851. virtual WUPriorityClass getPriority() const = 0;
  852. virtual int getPriorityLevel() const = 0;
  853. virtual IConstWUQuery * getQuery() const = 0;
  854. virtual bool getRescheduleFlag() const = 0;
  855. virtual IConstWUResult * getResultByName(const char * name) const = 0;
  856. virtual IConstWUResult * getResultBySequence(unsigned seq) const = 0;
  857. virtual unsigned getResultLimit() const = 0;
  858. virtual IConstWUResultIterator & getResults() const = 0;
  859. virtual IStringVal & getScope(IStringVal & str) const = 0;
  860. virtual IStringVal & getSecurityToken(IStringVal & str) const = 0;
  861. virtual WUState getState() const = 0;
  862. virtual IStringVal & getStateEx(IStringVal & str) const = 0;
  863. virtual __int64 getAgentSession() const = 0;
  864. virtual unsigned getAgentPID() const = 0;
  865. virtual IStringVal & getStateDesc(IStringVal & str) const = 0;
  866. virtual IConstWUResult * getTemporaryByName(const char * name) const = 0;
  867. virtual IConstWUResultIterator & getTemporaries() const = 0;
  868. virtual bool getRunningGraph(IStringVal & graphName, WUGraphIDType & subId) const = 0;
  869. virtual IConstWUWebServicesInfo * getWebServicesInfo() const = 0;
  870. virtual IConstWURoxieQueryInfo * getRoxieQueryInfo() const = 0;
  871. virtual IConstWUStatisticIterator & getStatistics(const IStatisticsFilter * filter) const = 0; // filter must currently stay alive while the iterator does.
  872. virtual IConstWUStatistic * getStatistic(const char * creator, const char * scope, StatisticKind kind) const = 0;
  873. virtual IStringVal & getUser(IStringVal & str) const = 0;
  874. virtual IStringVal & getWuScope(IStringVal & str) const = 0;
  875. virtual IConstWUResult * getVariableByName(const char * name) const = 0;
  876. virtual IConstWUResultIterator & getVariables() const = 0;
  877. virtual IStringVal & getWuid(IStringVal & str) const = 0;
  878. virtual bool isProtected() const = 0;
  879. virtual bool isPausing() const = 0;
  880. virtual IWorkUnit & lock() = 0;
  881. virtual bool reload() = 0;
  882. virtual void requestAbort() = 0;
  883. virtual void subscribe(WUSubscribeOptions options) = 0;
  884. virtual unsigned queryFileUsage(const char * filename) const = 0;
  885. virtual unsigned getCodeVersion() const = 0;
  886. virtual unsigned getWuidVersion() const = 0;
  887. virtual void getBuildVersion(IStringVal & buildVersion, IStringVal & eclVersion) const = 0;
  888. virtual bool getWuDate(unsigned & year, unsigned & month, unsigned & day) = 0;
  889. virtual IPropertyTree * getDiskUsageStats() = 0;
  890. virtual IPropertyTreeIterator & getFileIterator() const = 0;
  891. virtual bool getCloneable() const = 0;
  892. virtual IUserDescriptor * queryUserDescriptor() const = 0;
  893. virtual IStringVal & getSnapshot(IStringVal & str) const = 0;
  894. virtual IJlibDateTime & getTimeScheduled(IJlibDateTime & val) const = 0;
  895. virtual IPropertyTreeIterator & getFilesReadIterator() const = 0;
  896. virtual void protect(bool protectMode) = 0;
  897. virtual IStringVal & getAllowedClusters(IStringVal & str) const = 0;
  898. virtual int getPriorityValue() const = 0;
  899. virtual void remoteCheckAccess(IUserDescriptor * user, bool writeaccess) const = 0;
  900. virtual bool getAllowAutoQueueSwitch() const = 0;
  901. virtual IConstWULibrary * getLibraryByName(const char * name) const = 0;
  902. virtual unsigned getGraphCount() const = 0;
  903. virtual unsigned getSourceFileCount() const = 0;
  904. virtual unsigned getResultCount() const = 0;
  905. virtual unsigned getVariableCount() const = 0;
  906. virtual unsigned getApplicationValueCount() const = 0;
  907. virtual unsigned getDebugAgentListenerPort() const = 0;
  908. virtual IStringVal & getDebugAgentListenerIP(IStringVal & ip) const = 0;
  909. virtual IStringVal & getXmlParams(IStringVal & params) const = 0;
  910. virtual const IPropertyTree * getXmlParams() const = 0;
  911. virtual unsigned __int64 getHash() const = 0;
  912. virtual IStringIterator *getLogs(const char *type, const char *instance=NULL) const = 0;
  913. virtual IStringIterator *getProcesses(const char *type) const = 0;
  914. virtual IPropertyTreeIterator* getProcesses(const char *type, const char *instance) const = 0;
  915. };
  916. interface IDistributedFile;
  917. interface IWorkUnit : extends IConstWorkUnit
  918. {
  919. virtual void clearExceptions() = 0;
  920. virtual void commit() = 0;
  921. virtual IWUException * createException() = 0;
  922. virtual void addProcess(const char *type, const char *instance, unsigned pid, const char *log=NULL) = 0;
  923. virtual void setAction(WUAction action) = 0;
  924. virtual void setApplicationValue(const char * application, const char * propname, const char * value, bool overwrite) = 0;
  925. virtual void setApplicationValueInt(const char * application, const char * propname, int value, bool overwrite) = 0;
  926. virtual void incEventScheduledCount() = 0;
  927. virtual void setIsQueryService(bool cached) = 0;
  928. virtual void setClusterName(const char * value) = 0;
  929. virtual void setDebugValue(const char * propname, const char * value, bool overwrite) = 0;
  930. virtual void setDebugValueInt(const char * propname, int value, bool overwrite) = 0;
  931. virtual void setJobName(const char * value) = 0;
  932. virtual void setPriority(WUPriorityClass cls) = 0;
  933. virtual void setPriorityLevel(int level) = 0;
  934. virtual void setRescheduleFlag(bool value) = 0;
  935. virtual void setResultLimit(unsigned value) = 0;
  936. virtual void setSecurityToken(const char * value) = 0;
  937. virtual void setState(WUState state) = 0;
  938. virtual void setStateEx(const char * text) = 0;
  939. virtual void setAgentSession(__int64 sessionId) = 0;
  940. virtual void setStatistic(StatisticCreatorType creatorType, const char * creator, StatisticScopeType scopeType, const char * scope, StatisticKind kind, const char * optDescription, unsigned __int64 value, unsigned __int64 count, unsigned __int64 maxValue, StatsMergeAction mergeAction) = 0;
  941. virtual void setTracingValue(const char * propname, const char * value) = 0;
  942. virtual void setTracingValueInt(const char * propname, int value) = 0;
  943. virtual void setUser(const char * value) = 0;
  944. virtual void setWuScope(const char * value) = 0;
  945. virtual void setSnapshot(const char * value) = 0;
  946. virtual IWorkflowItemIterator * updateWorkflowItems() = 0;
  947. virtual void syncRuntimeWorkflow(IWorkflowItemArray * array) = 0;
  948. virtual IWorkflowItem * addWorkflowItem(unsigned wfid, WFType type, WFMode mode, unsigned success, unsigned failure, unsigned recovery, unsigned retriesAllowed, unsigned contingencyFor) = 0;
  949. virtual void resetWorkflow() = 0;
  950. virtual void schedule() = 0;
  951. virtual void deschedule() = 0;
  952. virtual unsigned addLocalFileUpload(LocalFileUploadType type, const char * source, const char * destination, const char * eventTag) = 0;
  953. virtual IWUResult * updateGlobalByName(const char * name) = 0;
  954. virtual IWUGraph * createGraph(const char * name, WUGraphType type, IPropertyTree *xgmml) = 0;
  955. virtual IWUGraph * updateGraph(const char * name) = 0;
  956. virtual IWUQuery * updateQuery() = 0;
  957. virtual IWUWebServicesInfo * updateWebServicesInfo(bool create) = 0;
  958. virtual IWURoxieQueryInfo * updateRoxieQueryInfo(const char * wuid, const char * roxieClusterName) = 0;
  959. virtual IWUPlugin * updatePluginByName(const char * name) = 0;
  960. virtual IWULibrary * updateLibraryByName(const char * name) = 0;
  961. virtual IWUResult * updateResultByName(const char * name) = 0;
  962. virtual IWUResult * updateResultBySequence(unsigned seq) = 0;
  963. virtual IWUResult * updateTemporaryByName(const char * name) = 0;
  964. virtual IWUResult * updateVariableByName(const char * name) = 0;
  965. virtual void addFile(const char * fileName, StringArray * clusters, unsigned usageCount, WUFileKind fileKind, const char * graphOwner) = 0;
  966. virtual void releaseFile(const char * fileName) = 0;
  967. virtual void setCodeVersion(unsigned version, const char * buildVersion, const char * eclVersion) = 0;
  968. virtual void deleteTempFiles(const char * graph, bool deleteOwned, bool deleteJobOwned) = 0;
  969. virtual void deleteTemporaries() = 0;
  970. virtual void addDiskUsageStats(__int64 avgNodeUsage, unsigned minNode, __int64 minNodeUsage, unsigned maxNode, __int64 maxNodeUsage, __int64 graphId) = 0;
  971. virtual void setCloneable(bool value) = 0;
  972. virtual void setIsClone(bool value) = 0;
  973. virtual void setTimeScheduled(const IJlibDateTime & val) = 0;
  974. virtual void noteFileRead(IDistributedFile * file) = 0;
  975. virtual void clearGraphProgress() = 0;
  976. virtual void resetBeforeGeneration() = 0;
  977. virtual bool switchThorQueue(const char * newcluster, IQueueSwitcher * qs) = 0;
  978. virtual void setAllowedClusters(const char * value) = 0;
  979. virtual void setAllowAutoQueueSwitch(bool val) = 0;
  980. virtual void setLibraryInformation(const char * name, unsigned interfaceHash, unsigned definitionHash) = 0;
  981. virtual void setDebugAgentListenerPort(unsigned port) = 0;
  982. virtual void setDebugAgentListenerIP(const char * ip) = 0;
  983. virtual void setXmlParams(const char *xml) = 0;
  984. virtual void setXmlParams(IPropertyTree *tree) = 0;
  985. virtual void setHash(unsigned __int64 hash) = 0;
  986. virtual void setResultInt(const char * name, unsigned sequence, __int64 val) = 0;
  987. virtual void setResultUInt(const char * name, unsigned sequence, unsigned __int64 val) = 0;
  988. virtual void setResultReal(const char *name, unsigned sequence, double val) = 0;
  989. virtual void setResultVarString(const char * stepname, unsigned sequence, const char *val) = 0;
  990. virtual void setResultVarUnicode(const char * stepname, unsigned sequence, UChar const *val) = 0;
  991. virtual void setResultString(const char * stepname, unsigned sequence, int len, const char *val) = 0;
  992. virtual void setResultData(const char * stepname, unsigned sequence, int len, const void *val) = 0;
  993. // virtual void doSetResultString(type_t type, const char *name, unsigned sequence, int len, const char *val) = 0;
  994. virtual void setResultRaw(const char * name, unsigned sequence, int len, const void *val) = 0;
  995. virtual void setResultSet(const char * name, unsigned sequence, bool isAll, size32_t len, const void *val, ISetToXmlTransformer *) = 0;
  996. virtual void setResultUnicode(const char * name, unsigned sequence, int len, UChar const * val) = 0;
  997. virtual void setResultBool(const char *name, unsigned sequence, bool val) = 0;
  998. virtual void setResultDecimal(const char *name, unsigned sequence, int len, int precision, bool isSigned, const void *val) = 0;
  999. virtual void setResultDataset(const char * name, unsigned sequence, size32_t len, const void *val, unsigned numRows, bool extend) = 0;
  1000. };
  1001. interface IConstWorkUnitIterator : extends IScmIterator
  1002. {
  1003. virtual IConstWorkUnit & query() = 0;
  1004. };
  1005. //! IWUTimers
  1006. interface IWUTimers : extends IInterface
  1007. {
  1008. virtual void setTrigger(const IJlibDateTime & dt) = 0;
  1009. virtual IJlibDateTime & getTrigger(IJlibDateTime & dt) const = 0;
  1010. virtual void setExpiration(const IJlibDateTime & dt) = 0;
  1011. virtual IJlibDateTime & getExpiration(IJlibDateTime & dt) const = 0;
  1012. virtual void setSubmission(const IJlibDateTime & dt) = 0;
  1013. virtual IJlibDateTime & getSubmission(IJlibDateTime & dt) const = 0;
  1014. };
  1015. //! IWUFactory
  1016. //! Used to instantiate WorkUnit components.
  1017. class MemoryBuffer;
  1018. interface ILocalWorkUnit : extends IWorkUnit
  1019. {
  1020. virtual void serialize(MemoryBuffer & tgt) = 0;
  1021. virtual void deserialize(MemoryBuffer & src) = 0;
  1022. virtual void loadXML(const char * xml) = 0;
  1023. virtual IConstWorkUnit * unlock() = 0;
  1024. };
  1025. enum WUSortField
  1026. {
  1027. WUSFuser = 1,
  1028. WUSFcluster = 2,
  1029. WUSFjob = 3,
  1030. WUSFstate = 4,
  1031. WUSFpriority = 5,
  1032. WUSFwuid = 6,
  1033. WUSFwuidhigh = 7,
  1034. WUSFfileread = 8,
  1035. WUSFroxiecluster = 9,
  1036. WUSFprotected = 10,
  1037. WUSFtotalthortime = 11,
  1038. WUSFwildwuid = 12,
  1039. WUSFecl = 13,
  1040. WUSFcustom = 14,
  1041. WUSFterm = 0,
  1042. WUSFreverse = 256,
  1043. WUSFnocase = 512,
  1044. WUSFnumeric = 1024,
  1045. WUSFwild = 2048
  1046. };
  1047. enum WUQueryFilterBoolean
  1048. {
  1049. WUQFSNo = 0,
  1050. WUQFSYes = 1,
  1051. WUQFSAll = 2
  1052. };
  1053. enum WUQuerySortField
  1054. {
  1055. WUQSFId = 1,
  1056. WUQSFname = 2,
  1057. WUQSFwuid = 3,
  1058. WUQSFdll = 4,
  1059. WUQSFmemoryLimit = 5,
  1060. WUQSFmemoryLimitHi = 6,
  1061. WUQSFtimeLimit = 7,
  1062. WUQSFtimeLimitHi = 8,
  1063. WUQSFwarnTimeLimit = 9,
  1064. WUQSFwarnTimeLimitHi = 10,
  1065. WUQSFpriority = 11,
  1066. WUQSFpriorityHi = 12,
  1067. WUQSFQuerySet = 13,
  1068. WUQSFActivited = 14,
  1069. WUQSFSuspendedByUser = 15,
  1070. WUQSFLibrary = 16,
  1071. WUQSFterm = 0,
  1072. WUQSFreverse = 256,
  1073. WUQSFnocase = 512,
  1074. WUQSFnumeric = 1024,
  1075. WUQSFwild = 2048
  1076. };
  1077. typedef IIteratorOf<IPropertyTree> IConstQuerySetQueryIterator;
  1078. interface IWorkUnitFactory : extends IInterface
  1079. {
  1080. virtual IWorkUnit * createWorkUnit(const char * app, const char * user) = 0;
  1081. virtual bool deleteWorkUnit(const char * wuid) = 0;
  1082. virtual IConstWorkUnit * openWorkUnit(const char * wuid, bool lock) = 0;
  1083. virtual IConstWorkUnitIterator * getWorkUnitsByOwner(const char * owner) = 0;
  1084. virtual IWorkUnit * updateWorkUnit(const char * wuid) = 0;
  1085. virtual int setTracingLevel(int newlevel) = 0;
  1086. virtual IWorkUnit * createNamedWorkUnit(const char * wuid, const char * app, const char * user) = 0;
  1087. virtual IConstWorkUnitIterator * getWorkUnitsByState(WUState state) = 0;
  1088. virtual IConstWorkUnitIterator * getWorkUnitsByECL(const char * ecl) = 0;
  1089. virtual IConstWorkUnitIterator * getWorkUnitsByCluster(const char * cluster) = 0;
  1090. virtual IConstWorkUnitIterator * getWorkUnitsByXPath(const char * xpath) = 0;
  1091. virtual IConstWorkUnitIterator * getWorkUnitsSorted(WUSortField * sortorder, WUSortField * filters, const void * filterbuf, unsigned startoffset, unsigned maxnum, const char * queryowner, __int64 * cachehint, unsigned *total) = 0;
  1092. virtual unsigned numWorkUnits() = 0;
  1093. virtual unsigned numWorkUnitsFiltered(WUSortField * filters, const void * filterbuf) = 0;
  1094. virtual void descheduleAllWorkUnits() = 0;
  1095. virtual bool deleteWorkUnitEx(const char * wuid) = 0;
  1096. virtual IConstQuerySetQueryIterator * getQuerySetQueriesSorted(WUQuerySortField *sortorder, WUQuerySortField *filters, const void *filterbuf, unsigned startoffset, unsigned maxnum, __int64 *cachehint, unsigned *total, const MapStringTo<bool> *subset) = 0;
  1097. };
  1098. interface IWorkflowScheduleConnection : extends IInterface
  1099. {
  1100. virtual void lock() = 0;
  1101. virtual void unlock() = 0;
  1102. virtual void setActive() = 0;
  1103. virtual void resetActive() = 0;
  1104. virtual bool queryActive() = 0;
  1105. virtual bool pull(IWorkflowItemArray * workflow) = 0;
  1106. virtual void push(const char * name, const char * text) = 0;
  1107. };
  1108. interface IExtendedWUInterface
  1109. {
  1110. virtual unsigned calculateHash(unsigned prevHash) = 0;
  1111. virtual void copyWorkUnit(IConstWorkUnit *cached, bool all) = 0;
  1112. virtual bool archiveWorkUnit(const char *base,bool del,bool ignoredllerrors,bool deleteOwned) = 0;
  1113. virtual void packWorkUnit(bool pack=true) = 0;
  1114. };
  1115. struct WorkunitUpdate : public Owned<IWorkUnit>
  1116. {
  1117. public:
  1118. WorkunitUpdate(IWorkUnit *wu) : Owned<IWorkUnit>(wu) { }
  1119. ~WorkunitUpdate() { if (get()) get()->commit(); }
  1120. };
  1121. class WuStatisticTarget : implements IStatisticTarget
  1122. {
  1123. public:
  1124. WuStatisticTarget(IWorkUnit * _wu, const char * _defaultWho) : wu(_wu), defaultWho(_defaultWho) {}
  1125. virtual void addStatistic(StatisticScopeType scopeType, const char * scope, StatisticKind kind, char * description, unsigned __int64 value, unsigned __int64 count, unsigned __int64 maxValue, StatsMergeAction mergeAction)
  1126. {
  1127. wu->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), scopeType, scope, kind, description, value, count, maxValue, mergeAction);
  1128. }
  1129. protected:
  1130. Linked<IWorkUnit> wu;
  1131. const char * defaultWho;
  1132. };
  1133. extern WORKUNIT_API IStringVal &getEclCCServerQueueNames(IStringVal &ret, const char *process);
  1134. extern WORKUNIT_API IStringVal &getEclServerQueueNames(IStringVal &ret, const char *process);
  1135. extern WORKUNIT_API IStringVal &getEclSchedulerQueueNames(IStringVal &ret, const char *process);
  1136. extern WORKUNIT_API IStringVal &getAgentQueueNames(IStringVal &ret, const char *process);
  1137. extern WORKUNIT_API IStringVal &getRoxieQueueNames(IStringVal &ret, const char *process);
  1138. extern WORKUNIT_API IStringVal &getThorQueueNames(IStringVal &ret, const char *process);
  1139. extern WORKUNIT_API StringBuffer &getClusterThorQueueName(StringBuffer &ret, const char *cluster);
  1140. extern WORKUNIT_API StringBuffer &getClusterThorGroupName(StringBuffer &ret, const char *cluster);
  1141. extern WORKUNIT_API StringBuffer &getClusterRoxieQueueName(StringBuffer &ret, const char *cluster);
  1142. extern WORKUNIT_API StringBuffer &getClusterEclCCServerQueueName(StringBuffer &ret, const char *cluster);
  1143. extern WORKUNIT_API StringBuffer &getClusterEclServerQueueName(StringBuffer &ret, const char *cluster);
  1144. extern WORKUNIT_API StringBuffer &getClusterEclAgentQueueName(StringBuffer &ret, const char *cluster);
  1145. extern WORKUNIT_API IStringIterator *getTargetClusters(const char *processType, const char *processName);
  1146. extern WORKUNIT_API bool validateTargetClusterName(const char *clustname);
  1147. extern WORKUNIT_API IConstWUClusterInfo* getTargetClusterInfo(const char *clustname);
  1148. typedef IArrayOf<IConstWUClusterInfo> CConstWUClusterInfoArray;
  1149. extern WORKUNIT_API unsigned getEnvironmentClusterInfo(CConstWUClusterInfoArray &clusters);
  1150. extern WORKUNIT_API unsigned getEnvironmentClusterInfo(IPropertyTree* environmentRoot, CConstWUClusterInfoArray &clusters);
  1151. extern WORKUNIT_API void getRoxieProcessServers(const char *process, SocketEndpointArray &servers);
  1152. extern WORKUNIT_API bool isProcessCluster(const char *remoteDali, const char *process);
  1153. extern WORKUNIT_API bool isProcessCluster(const char *process);
  1154. extern WORKUNIT_API IStatisticGatherer * createGlobalStatisticGatherer(IWorkUnit * wu);
  1155. extern WORKUNIT_API bool getWorkUnitCreateTime(const char *wuid,CDateTime &time); // based on WUID
  1156. extern WORKUNIT_API bool restoreWorkUnit(const char *base,const char *wuid);
  1157. extern WORKUNIT_API void clientShutdownWorkUnit();
  1158. extern WORKUNIT_API IExtendedWUInterface * queryExtendedWU(IWorkUnit * wu);
  1159. extern WORKUNIT_API unsigned getEnvironmentThorClusterNames(StringArray &thorNames, StringArray &groupNames, StringArray &targetNames, StringArray &queueNames);
  1160. extern WORKUNIT_API unsigned getEnvironmentHThorClusterNames(StringArray &eclAgentNames, StringArray &groupNames, StringArray &targetNames);
  1161. extern WORKUNIT_API StringBuffer &formatGraphTimerLabel(StringBuffer &str, const char *graphName, unsigned subGraphNum=0, unsigned __int64 subId=0);
  1162. extern WORKUNIT_API StringBuffer &formatGraphTimerScope(StringBuffer &str, const char *graphName, unsigned subGraphNum, unsigned __int64 subId);
  1163. extern WORKUNIT_API bool parseGraphTimerLabel(const char *label, StringAttr &graphName, unsigned & graphNum, unsigned &subGraphNum, unsigned &subId);
  1164. extern WORKUNIT_API bool parseGraphScope(const char *scope, StringAttr &graphName, unsigned & graphNum, unsigned &subGraphId);
  1165. extern WORKUNIT_API void addExceptionToWorkunit(IWorkUnit * wu, WUExceptionSeverity severity, const char * source, unsigned code, const char * text, const char * filename, unsigned lineno, unsigned column);
  1166. extern WORKUNIT_API IWorkUnitFactory * getWorkUnitFactory();
  1167. extern WORKUNIT_API IWorkUnitFactory * getSecWorkUnitFactory(ISecManager &secmgr, ISecUser &secuser);
  1168. extern WORKUNIT_API IWorkUnitFactory * getWorkUnitFactory(ISecManager *secmgr, ISecUser *secuser);
  1169. extern WORKUNIT_API ILocalWorkUnit* createLocalWorkUnit();
  1170. extern WORKUNIT_API IStringVal& exportWorkUnitToXML(const IConstWorkUnit *wu, IStringVal &str, bool unpack, bool includeProgress);
  1171. extern WORKUNIT_API StringBuffer &exportWorkUnitToXML(const IConstWorkUnit *wu, StringBuffer &str, bool unpack, bool includeProgress);
  1172. extern WORKUNIT_API void exportWorkUnitToXMLFile(const IConstWorkUnit *wu, const char * filename, unsigned extraXmlFlags, bool unpack, bool includeProgress);
  1173. extern WORKUNIT_API void submitWorkUnit(const char *wuid, const char *username, const char *password);
  1174. extern WORKUNIT_API void abortWorkUnit(const char *wuid);
  1175. extern WORKUNIT_API void submitWorkUnit(const char *wuid, ISecManager *secmgr, ISecUser *secuser);
  1176. extern WORKUNIT_API void abortWorkUnit(const char *wuid, ISecManager *secmgr, ISecUser *secuser);
  1177. extern WORKUNIT_API void secSubmitWorkUnit(const char *wuid, ISecManager &secmgr, ISecUser &secuser);
  1178. extern WORKUNIT_API void secAbortWorkUnit(const char *wuid, ISecManager &secmgr, ISecUser &secuser);
  1179. extern WORKUNIT_API IWUResult * updateWorkUnitResult(IWorkUnit * w, const char *name, unsigned sequence);
  1180. extern WORKUNIT_API IConstWUResult * getWorkUnitResult(IConstWorkUnit * w, const char *name, unsigned sequence);
  1181. extern WORKUNIT_API void updateSuppliedXmlParams(IWorkUnit * w);
  1182. //returns a state code. WUStateUnknown == timeout
  1183. extern WORKUNIT_API WUState waitForWorkUnitToComplete(const char * wuid, int timeout = -1, bool returnOnWaitState = false);
  1184. extern WORKUNIT_API bool waitForWorkUnitToCompile(const char * wuid, int timeout = -1);
  1185. extern WORKUNIT_API WUState secWaitForWorkUnitToComplete(const char * wuid, ISecManager &secmgr, ISecUser &secuser, int timeout = -1, bool returnOnWaitState = false);
  1186. extern WORKUNIT_API bool secWaitForWorkUnitToCompile(const char * wuid, ISecManager &secmgr, ISecUser &secuser, int timeout = -1);
  1187. extern WORKUNIT_API bool secDebugWorkunit(const char * wuid, ISecManager &secmgr, ISecUser &secuser, const char *command, StringBuffer &response);
  1188. extern WORKUNIT_API IStringVal& createToken(const char *wuid, const char *user, const char *password, IStringVal &str);
  1189. // This latter is temporary - tokens will be replaced by something more secure
  1190. extern WORKUNIT_API void extractToken(const char *token, const char *wuid, IStringVal &user, IStringVal &password);
  1191. extern WORKUNIT_API WUState getWorkUnitState(const char* state);
  1192. extern WORKUNIT_API IWorkflowScheduleConnection * getWorkflowScheduleConnection(char const * wuid);
  1193. extern WORKUNIT_API const char *skipLeadingXml(const char *text);
  1194. extern WORKUNIT_API bool isArchiveQuery(const char * text);
  1195. extern WORKUNIT_API bool isQueryManifest(const char * text);
  1196. extern WORKUNIT_API IPropertyTree * resolveDefinitionInArchive(IPropertyTree * archive, const char * path);
  1197. inline bool isLibrary(IConstWorkUnit * wu) { return wu->getApplicationValueInt("LibraryModule", "interfaceHash", 0) != 0; }
  1198. extern WORKUNIT_API bool looksLikeAWuid(const char * wuid);
  1199. enum WUQueryActivationOptions
  1200. {
  1201. DO_NOT_ACTIVATE = 0,
  1202. MAKE_ACTIVATE= 1,
  1203. ACTIVATE_SUSPEND_PREVIOUS = 2,
  1204. ACTIVATE_DELETE_PREVIOUS = 3,
  1205. DO_NOT_ACTIVATE_LOAD_DATA_ONLY = 4,
  1206. MAKE_ACTIVATE_LOAD_DATA_ONLY = 5
  1207. };
  1208. extern WORKUNIT_API int calcPriorityValue(const IPropertyTree * p); // Calls to this should really go through the workunit interface.
  1209. extern WORKUNIT_API IPropertyTree * addNamedQuery(IPropertyTree * queryRegistry, const char * name, const char * wuid, const char * dll, bool library, const char *userid, const char *snapshot); // result not linked
  1210. extern WORKUNIT_API void removeNamedQuery(IPropertyTree * queryRegistry, const char * id);
  1211. extern WORKUNIT_API void removeWuidFromNamedQueries(IPropertyTree * queryRegistry, const char * wuid);
  1212. extern WORKUNIT_API void removeDllFromNamedQueries(IPropertyTree * queryRegistry, const char * dll);
  1213. extern WORKUNIT_API void removeAliasesFromNamedQuery(IPropertyTree * queryRegistry, const char * id);
  1214. extern WORKUNIT_API void setQueryAlias(IPropertyTree * queryRegistry, const char * name, const char * value);
  1215. extern WORKUNIT_API IPropertyTree * getQueryById(IPropertyTree * queryRegistry, const char *queryid);
  1216. extern WORKUNIT_API IPropertyTree * getQueryById(const char *queryset, const char *queryid, bool readonly);
  1217. extern WORKUNIT_API IPropertyTree * resolveQueryAlias(IPropertyTree * queryRegistry, const char * alias);
  1218. extern WORKUNIT_API IPropertyTree * resolveQueryAlias(const char *queryset, const char *alias, bool readonly);
  1219. extern WORKUNIT_API IPropertyTree * getQueryRegistry(const char * wsEclId, bool readonly);
  1220. extern WORKUNIT_API IPropertyTree * getQueryRegistryRoot();
  1221. extern WORKUNIT_API void checkAddLibrariesToQueryEntry(IPropertyTree *queryTree, IConstWULibraryIterator *libraries);
  1222. extern WORKUNIT_API void checkAddLibrariesToQueryEntry(IPropertyTree *queryTree, IConstWorkUnit *cw);
  1223. extern WORKUNIT_API void setQueryCommentForNamedQuery(IPropertyTree * queryRegistry, const char *id, const char *queryComment);
  1224. extern WORKUNIT_API void setQuerySuspendedState(IPropertyTree * queryRegistry, const char * name, bool suspend, const char *userid);
  1225. extern WORKUNIT_API IPropertyTree * addNamedPackageSet(IPropertyTree * packageRegistry, const char * name, IPropertyTree *packageInfo, bool overWrite); // result not linked
  1226. extern WORKUNIT_API void removeNamedPackage(IPropertyTree * packageRegistry, const char * id);
  1227. extern WORKUNIT_API IPropertyTree * getPackageSetRegistry(const char * wsEclId, bool readonly);
  1228. extern WORKUNIT_API void addQueryToQuerySet(IWorkUnit *workunit, IPropertyTree *queryRegistry, const char *queryName, WUQueryActivationOptions activateOption, StringBuffer &newQueryId, const char *userid);
  1229. extern WORKUNIT_API void addQueryToQuerySet(IWorkUnit *workunit, const char *querySetName, const char *queryName, WUQueryActivationOptions activateOption, StringBuffer &newQueryId, const char *userid);
  1230. extern WORKUNIT_API void activateQuery(IPropertyTree *queryRegistry, WUQueryActivationOptions activateOption, const char *queryName, const char *queryId, const char *userid);
  1231. extern WORKUNIT_API bool removeQuerySetAlias(const char *querySetName, const char *alias);
  1232. extern WORKUNIT_API void addQuerySetAlias(const char *querySetName, const char *alias, const char *id);
  1233. extern WORKUNIT_API void setSuspendQuerySetQuery(const char *querySetName, const char *id, bool suspend, const char *userid);
  1234. extern WORKUNIT_API void deleteQuerySetQuery(const char *querySetName, const char *id);
  1235. extern WORKUNIT_API const char *queryIdFromQuerySetWuid(IPropertyTree *queryRegistry, const char *wuid, const char *queryName, IStringVal &id);
  1236. extern WORKUNIT_API const char *queryIdFromQuerySetWuid(const char *querySetName, const char *wuid, const char *queryName, IStringVal &id);
  1237. extern WORKUNIT_API void removeQuerySetAliasesFromNamedQuery(const char *querySetName, const char * id);
  1238. extern WORKUNIT_API void setQueryCommentForNamedQuery(const char *querySetName, const char *id, const char *comment);
  1239. extern WORKUNIT_API void gatherLibraryNames(StringArray &names, StringArray &unresolved, IWorkUnitFactory &workunitFactory, IConstWorkUnit &cw, IPropertyTree *queryset);
  1240. extern WORKUNIT_API void associateLocalFile(IWUQuery * query, WUFileType type, const char * name, const char * description, unsigned crc);
  1241. interface ITimeReporter;
  1242. extern WORKUNIT_API void updateWorkunitTimeStat(IWorkUnit * wu, StatisticScopeType scopeType, const char * scope, StatisticKind kind, const char * description, unsigned __int64 value);
  1243. extern WORKUNIT_API void updateWorkunitTimings(IWorkUnit * wu, ITimeReporter *timer);
  1244. extern WORKUNIT_API void getWorkunitTotalTime(IConstWorkUnit* workunit, const char* creator, unsigned __int64 & totalTimeNs, unsigned __int64 & totalThisTimeNs);
  1245. extern WORKUNIT_API IConstWUStatistic * getStatistic(IConstWorkUnit * wu, const IStatisticsFilter & filter);
  1246. extern WORKUNIT_API const char *getTargetClusterComponentName(const char *clustname, const char *processType, StringBuffer &name);
  1247. extern WORKUNIT_API void descheduleWorkunit(char const * wuid);
  1248. #if 0
  1249. void WORKUNIT_API testWorkflow();
  1250. #endif
  1251. extern WORKUNIT_API const char * getWorkunitStateStr(WUState state);
  1252. extern WORKUNIT_API void addTimeStamp(IWorkUnit * wu, StatisticScopeType scopeType, const char * scope, StatisticKind kind);
  1253. #endif