Workunit.ecl 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*##############################################################################
  2. ## HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®. All rights reserved.
  3. ############################################################################## */
  4. import lib_workunitservices;
  5. RETURN MODULE
  6. EXPORT WorkunitRecord := lib_workunitservices.WsWorkunitRecord;
  7. EXPORT TimeStampRecord := lib_workunitservices.WsTimeStamp;
  8. EXPORT MessageRecord := lib_workunitservices.WsMessage;
  9. EXPORT FileReadRecord := lib_workunitservices.WsFileRead;
  10. EXPORT FileWrittenRecord := lib_workunitservices.WsFileWritten;
  11. EXPORT TimingRecord := lib_workunitservices.WsTiming;
  12. /**
  13. The statistic record exported from the plugin has the following format:
  14. WsStatistic := RECORD
  15. unsigned8 value;
  16. unsigned8 count;
  17. unsigned8 maxValue;
  18. string creatorType;
  19. string creator;
  20. string scopeType;
  21. string scope;
  22. string name;
  23. string description;
  24. string unit;
  25. END;
  26. */
  27. EXPORT StatisticRecord := lib_workunitservices.WsStatistic;
  28. /*
  29. * Returns a Boolean indication whether the work unit exists.
  30. *
  31. * @param wuid A string containing the WorkUnit IDentifier to locate.
  32. * @param online the flag specifying whether the search is performed online.
  33. * @param archived the flag specifying whether the search is performed in the archives.
  34. */
  35. EXPORT BOOLEAN WorkunitExists(varstring wuid, boolean online=true, boolean archived=false) :=
  36. lib_workunitservices.WorkUnitServices.WorkunitExists(wuid, online, archived);
  37. /*
  38. * Returns a dataset of all workunits that meet the search criteria.
  39. *
  40. * @param lowwuid the lowest WorkUnit IDentifier to list. This may be an empty string.
  41. * @param highwuid the highest WorkUnit IDentifier to list.
  42. * @param cluster the name of the cluster the workunit ran on.
  43. * @param jobname the name of the workunit. This may contain wildcard ( * ? ) characters.
  44. * @param state the state of the workunit.
  45. * @param priority a string containing the priority of the workunit.
  46. * @param fileread the name of a file read by the workunit. This may contain wildcard ( * ? ) characters.
  47. * @param filewritten the name of a file written by the workunit. This may contain wildcard ( * ? ) characters.
  48. * @param roxiecluster the name of the Roxie cluster.
  49. * @param eclcontains the text to search for in the workunit�s ECL code. This may contain wildcard ( * ? ) characters.
  50. * @param online the flag specifying whether the search is performed online.
  51. * @param archived the flag specifying whether the search is performed in the archives.
  52. * @param appvalues application values to search for. Use a string of the form appname/key=value or appname/*=value.
  53. */
  54. EXPORT dataset(WorkunitRecord) WorkunitList(
  55. varstring lowwuid='',
  56. varstring highwuid='',
  57. varstring username='',
  58. varstring cluster='',
  59. varstring jobname='',
  60. varstring state='',
  61. varstring priority='',
  62. varstring fileread='',
  63. varstring filewritten='',
  64. varstring roxiecluster='',
  65. varstring eclcontains='',
  66. boolean online=true,
  67. boolean archived=false,
  68. varstring appvalues=''
  69. ) :=
  70. lib_workunitservices.WorkUnitServices.WorkunitList(
  71. lowwuid, highwuid,
  72. username, cluster, jobname, state, priority,
  73. fileread, filewritten, roxiecluster, eclcontains,
  74. online, archived, appvalues);
  75. /*
  76. * Returns a valid Workunit identifier for the specified date and time. This is useful for creating ranges of wuids
  77. * that can be passed to WorkunitList()
  78. *
  79. * @param year the year
  80. * @param month the month
  81. * @param day the day
  82. * @param hour the hour
  83. * @param minute the minute
  84. */
  85. EXPORT VARSTRING WUIDonDate(UNSIGNED4 year, UNSIGNED4 month, UNSIGNED4 day, UNSIGNED4 hour, UNSIGNED4 minute) :=
  86. lib_workunitservices.WorkUnitServices.WUIDonDate(year,month,day,hour,minute);
  87. /*
  88. * Returns a valid Workunit identifier for a work unit that would be been created in the past.
  89. *
  90. * @param days_ago the number of days in the past to create the wuid for.
  91. */
  92. EXPORT VARSTRING WUIDdaysAgo(UNSIGNED4 days_ago) :=
  93. lib_workunitservices.WorkUnitServices.WUIDdaysAgo(days_ago);
  94. /*
  95. * Returns the timestamp information from a particular workunit.
  96. *
  97. * @param wuid the name of the workunit
  98. */
  99. EXPORT dataset(TimeStampRecord) WorkunitTimeStamps(varstring wuid) :=
  100. lib_workunitservices.WorkUnitServices.WorkunitTimeStamps(wuid);
  101. /*
  102. * Returns a dataset of the messages reported from a particular workunit.
  103. *
  104. * @param wuid the name of the workunit
  105. */
  106. EXPORT dataset(MessageRecord) WorkunitMessages(varstring wuid) :=
  107. lib_workunitservices.WorkUnitServices.WorkunitMessages(wuid);
  108. /*
  109. * Returns a dataset of the files that were read by a particular workunit.
  110. *
  111. * @param wuid the name of the workunit
  112. */
  113. EXPORT dataset(FileReadRecord) WorkunitFilesRead(varstring wuid) :=
  114. lib_workunitservices.WorkUnitServices.WorkunitFilesRead(wuid);
  115. /*
  116. * Returns a dataset of files that were written by a particular workunit.
  117. *
  118. * @param wuid the name of the workunit
  119. */
  120. EXPORT dataset(FileWrittenRecord) WorkunitFilesWritten(varstring wuid) :=
  121. lib_workunitservices.WorkUnitServices.WorkunitFilesWritten(wuid);
  122. /*
  123. * Returns the timing information from a particular workunit.
  124. *
  125. * @param wuid the name of the workunit
  126. */
  127. EXPORT dataset(TimingRecord) WorkunitTimings(varstring wuid) :=
  128. lib_workunitservices.WorkUnitServices.WorkunitTimings(wuid);
  129. /*
  130. * Returns the statistics from a particular workunit.
  131. *
  132. * @param wuid the name of the workunit
  133. */
  134. EXPORT dataset(StatisticRecord) WorkunitStatistics(varstring wuid, boolean includeActivities = false, varstring _filter = '') :=
  135. lib_workunitservices.WorkUnitServices.WorkunitStatistics(wuid, includeActivities, _filter);
  136. /*
  137. * Sets an application value in current workunit. Returns true if the value was set successfully.
  138. *
  139. * @param app the app name to set.
  140. * @param key the name of the value to set.
  141. * @param value the value to set.
  142. * @param overwrite whether an existing value should be overwritten (default=true).
  143. */
  144. EXPORT boolean SetWorkunitAppValue(varstring app, varstring key, varstring value, boolean overwrite=true) :=
  145. lib_workunitservices.WorkUnitServices.SetWorkunitAppValue(app, key, value, overwrite);
  146. END;