|
1 | | -# the java Calendar class is used to create java Date objects |
2 | | -from java.util import Calendar |
3 | | -from usace.rowcps.headless import LoggingOptions |
4 | | - |
5 | | -# Description of: LoggingOptions.setDbMessageLevel(int level) |
6 | | -# |
7 | | -# Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended |
8 | | -# level is 2, as this provides basic information about the time series |
9 | | -# retrieval/storage. |
10 | | -# |
11 | | -# Message Level | Description |
12 | | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| |
13 | | -# <=0 | Default value, does not do anything. Lower values do not change behavior. | |
14 | | -# 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | |
15 | | -# 2 | Adds message with name of time series, and the units to retrieve/store. | |
16 | | -# 3 | Adds message with the current time. | |
17 | | -# 4 | Adds message with first 10 dates and values from each time series. | |
18 | | -# >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | |
19 | | -# --------------|-------------------------------------------------------------------------------------------------------------------------------| |
20 | | - |
21 | | -LoggingOptions.setDbMessageLevel(2) |
22 | | - |
23 | | - |
24 | | -# Description of: LoggingOptions.setMetricsEnabled(boolean value) |
25 | | -# |
26 | | -# Enables or disables the storage of REGI's Metric data pertaining to the |
27 | | -# performance of the application. This is incredibly helpful for identifying |
28 | | -# issues where the application takes an excessive amount of time to operate. |
29 | | -# |
30 | | -# Metrics also log the location of the files as an INFO message if they are |
31 | | -# enabled. |
32 | | -# |
33 | | -# By default, Metrics are disabled. |
34 | | - |
35 | | -# LoggingOptions.setMetricsEnabled(True) |
36 | | - |
37 | | -# this gets a scriptable Gate Settings object |
38 | | -gateSettings = registry.getCalculation(1.0, "Gate Settings") |
39 | | - |
40 | | -# configure the start calendar |
41 | | -startCal = Calendar.getInstance() |
42 | | -#startCal.clear() |
43 | | -startCal.add(Calendar.DAY_OF_MONTH, -5) |
44 | | -startCal.set(Calendar.HOUR, 0) ######use Calendar.HOUR_OF_DAY |
45 | | -startCal.set(Calendar.MINUTE, 0) |
46 | | -startCal.set(Calendar.SECOND, 0) |
47 | | -startCal.set(Calendar.MILLISECOND, 0) |
48 | | -# create a java Calendar object that will be used to create the end Date |
49 | | -endCal = Calendar.getInstance() |
50 | | -endCal.add(Calendar.DAY_OF_MONTH, 1) |
51 | | -endCal.set(Calendar.HOUR, 0) |
52 | | -endCal.set(Calendar.MINUTE, 0) |
53 | | -endCal.set(Calendar.SECOND, 0) |
54 | | -endCal.set(Calendar.MILLISECOND, 0) |
55 | | -#endCal.clear() |
56 | | -#endCal.set(Calendar.YEAR, 2016) |
57 | | -#endCal.set(Calendar.MONTH, 4) |
58 | | - |
59 | | - |
60 | | -# gateSettings contains four callable methods |
61 | | -# void createGateSettings(String officeId, String locationStr, Date startDate, Date end) throws Exception; |
62 | | -# void createGateSettingsGroup(String officeId, String locationStr, Date startDate, Date end, String groupId) throws Exception; |
63 | | -# void createGateSettingsOutlet(String officeId, String locationStr, Date startDate, Date end, String outletId) throws Exception; |
64 | | -# void createGateSettingsOutletFromTs(String officeId, String locationStr, Date startDate, Date end, String outletId, String tsId) throws Exception; |
65 | | - |
66 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "FFLT2", startCal.getTime(), endCal.getTime(), "Release", "FFLT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) |
67 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "EAMT2", startCal.getTime(), endCal.getTime(), "Release", "EAMT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) |
68 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "TRNT2", startCal.getTime(), endCal.getTime(), "Release", "TRNT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) |
69 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "BPRT2", startCal.getTime(), endCal.getTime(), "Release", "BPRT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) |
70 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "LLST2", startCal.getTime(), endCal.getTime(), "Release", "LLST2.Opening.Const.0.0.Rev-BRA-Decodes" ) |
71 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "GBYT2", startCal.getTime(), endCal.getTime(), "Release", "GBYT2.Opening.Const.0.0.Rev-BRA-Decodes" ) |
72 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "PSMT2", startCal.getTime(), endCal.getTime(), "Release", "PSMT2.Opening.Const.0.0.Rev-BRA-Decodes" ) |
73 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "MSDT2", startCal.getTime(), endCal.getTime(), "Release", "MSDT2.Opening.Const.0.0.Rev-LCRA-Decodes" ) |
74 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "FRHT2", startCal.getTime(), endCal.getTime(), "Release", "FRHT2.Opening.Const.0.0.Raw-Observer" ) |
75 | | -gateSettings.createGateSettingsOutletFromTs("SWF", "GPET2", startCal.getTime(), endCal.getTime(), "Release", "GPET2.Opening.Const.0.0.Raw-Observer" ) |
| 1 | +from regi_python import regi_session, run_headless |
76 | 2 |
|
77 | 3 |
|
| 4 | +def run_calculations(registry): |
| 5 | + # Java imports must happen after regi_session starts the JVM. |
| 6 | + # the java Calendar class is used to create java Date objects |
| 7 | + from java.util import Calendar |
| 8 | + from usace.rowcps.headless import LoggingOptions |
78 | 9 |
|
| 10 | + # Description of: LoggingOptions.setDbMessageLevel(int level) |
| 11 | + # |
| 12 | + # Adds Time Series logging messages in the OracleTimeSeriesDaoImpl. Recommended |
| 13 | + # level is 2, as this provides basic information about the time series |
| 14 | + # retrieval/storage. |
| 15 | + # |
| 16 | + # Message Level | Description |
| 17 | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| |
| 18 | + # <=0 | Default value, does not do anything. Lower values do not change behavior. | |
| 19 | + # 1 | Logs message when no data is found. Logs message when data is found, how much was retrieved or stored, and how long it took. | |
| 20 | + # 2 | Adds message with name of time series, and the units to retrieve/store. | |
| 21 | + # 3 | Adds message with the current time. | |
| 22 | + # 4 | Adds message with first 10 dates and values from each time series. | |
| 23 | + # >4 | Same as 4, but shows all values retrieved from each time series. Higher values do not change behavior. | |
| 24 | + # --------------|-------------------------------------------------------------------------------------------------------------------------------| |
79 | 25 |
|
| 26 | + LoggingOptions.setDbMessageLevel(2) |
| 27 | + |
| 28 | + |
| 29 | + # Description of: LoggingOptions.setMetricsEnabled(boolean value) |
| 30 | + # |
| 31 | + # Enables or disables the storage of REGI's Metric data pertaining to the |
| 32 | + # performance of the application. This is incredibly helpful for identifying |
| 33 | + # issues where the application takes an excessive amount of time to operate. |
| 34 | + # |
| 35 | + # Metrics also log the location of the files as an INFO message if they are |
| 36 | + # enabled. |
| 37 | + # |
| 38 | + # By default, Metrics are disabled. |
| 39 | + |
| 40 | + # LoggingOptions.setMetricsEnabled(True) |
| 41 | + |
| 42 | + # this gets a scriptable Gate Settings object |
| 43 | + gateSettings = registry.getCalculation(1.0, "Gate Settings") |
| 44 | + |
| 45 | + # configure the start calendar |
| 46 | + startCal = Calendar.getInstance() |
| 47 | + #startCal.clear() |
| 48 | + startCal.add(Calendar.DAY_OF_MONTH, -5) |
| 49 | + startCal.set(Calendar.HOUR, 0) ######use Calendar.HOUR_OF_DAY |
| 50 | + startCal.set(Calendar.MINUTE, 0) |
| 51 | + startCal.set(Calendar.SECOND, 0) |
| 52 | + startCal.set(Calendar.MILLISECOND, 0) |
| 53 | + # create a java Calendar object that will be used to create the end Date |
| 54 | + endCal = Calendar.getInstance() |
| 55 | + endCal.add(Calendar.DAY_OF_MONTH, 1) |
| 56 | + endCal.set(Calendar.HOUR, 0) |
| 57 | + endCal.set(Calendar.MINUTE, 0) |
| 58 | + endCal.set(Calendar.SECOND, 0) |
| 59 | + endCal.set(Calendar.MILLISECOND, 0) |
| 60 | + #endCal.clear() |
| 61 | + #endCal.set(Calendar.YEAR, 2016) |
| 62 | + #endCal.set(Calendar.MONTH, 4) |
| 63 | + |
| 64 | + |
| 65 | + # gateSettings contains four callable methods |
| 66 | + # void createGateSettings(String officeId, String locationStr, Date startDate, Date end) throws Exception; |
| 67 | + # void createGateSettingsGroup(String officeId, String locationStr, Date startDate, Date end, String groupId) throws Exception; |
| 68 | + # void createGateSettingsOutlet(String officeId, String locationStr, Date startDate, Date end, String outletId) throws Exception; |
| 69 | + # void createGateSettingsOutletFromTs(String officeId, String locationStr, Date startDate, Date end, String outletId, String tsId) throws Exception; |
| 70 | + |
| 71 | + gateSettings.createGateSettingsOutletFromTs("SWF", "FFLT2", startCal.getTime(), endCal.getTime(), "Release", "FFLT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) |
| 72 | + gateSettings.createGateSettingsOutletFromTs("SWF", "EAMT2", startCal.getTime(), endCal.getTime(), "Release", "EAMT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) |
| 73 | + gateSettings.createGateSettingsOutletFromTs("SWF", "TRNT2", startCal.getTime(), endCal.getTime(), "Release", "TRNT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) |
| 74 | + gateSettings.createGateSettingsOutletFromTs("SWF", "BPRT2", startCal.getTime(), endCal.getTime(), "Release", "BPRT2.Opening.Const.0.0.Rev-TRWD-Decodes" ) |
| 75 | + gateSettings.createGateSettingsOutletFromTs("SWF", "LLST2", startCal.getTime(), endCal.getTime(), "Release", "LLST2.Opening.Const.0.0.Rev-BRA-Decodes" ) |
| 76 | + gateSettings.createGateSettingsOutletFromTs("SWF", "GBYT2", startCal.getTime(), endCal.getTime(), "Release", "GBYT2.Opening.Const.0.0.Rev-BRA-Decodes" ) |
| 77 | + gateSettings.createGateSettingsOutletFromTs("SWF", "PSMT2", startCal.getTime(), endCal.getTime(), "Release", "PSMT2.Opening.Const.0.0.Rev-BRA-Decodes" ) |
| 78 | + gateSettings.createGateSettingsOutletFromTs("SWF", "MSDT2", startCal.getTime(), endCal.getTime(), "Release", "MSDT2.Opening.Const.0.0.Rev-LCRA-Decodes" ) |
| 79 | + gateSettings.createGateSettingsOutletFromTs("SWF", "FRHT2", startCal.getTime(), endCal.getTime(), "Release", "FRHT2.Opening.Const.0.0.Raw-Observer" ) |
| 80 | + gateSettings.createGateSettingsOutletFromTs("SWF", "GPET2", startCal.getTime(), endCal.getTime(), "Release", "GPET2.Opening.Const.0.0.Raw-Observer" ) |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +if __name__ == "__main__": |
| 88 | + with regi_session(): |
| 89 | + run_headless(run_calculations) |
0 commit comments