forked from D-Net/dnet-hadoop
Flags & limiters for Sarc stats
This commit is contained in:
parent
2de17e7f32
commit
715bbd487d
|
@ -53,6 +53,11 @@ public class ExecuteWorkflow {
|
||||||
static boolean irusProcessStats;
|
static boolean irusProcessStats;
|
||||||
static int irusNumberOfOpendoarsToDownload;
|
static int irusNumberOfOpendoarsToDownload;
|
||||||
|
|
||||||
|
static boolean sarcCreateTablesEmptyDirs;
|
||||||
|
static boolean sarcDownloadReports;
|
||||||
|
static boolean sarcProcessStats;
|
||||||
|
static int sarcNumberOfOpendoarsToDownload;
|
||||||
|
|
||||||
public static void main(String args[]) throws Exception {
|
public static void main(String args[]) throws Exception {
|
||||||
|
|
||||||
// Sending the logs to the console
|
// Sending the logs to the console
|
||||||
|
@ -135,6 +140,21 @@ public class ExecuteWorkflow {
|
||||||
irusProcessStats = false;
|
irusProcessStats = false;
|
||||||
irusNumberOfOpendoarsToDownload = Integer.parseInt(parser.get("irusNumberOfOpendoarsToDownload"));
|
irusNumberOfOpendoarsToDownload = Integer.parseInt(parser.get("irusNumberOfOpendoarsToDownload"));
|
||||||
|
|
||||||
|
|
||||||
|
if (parser.get("sarcCreateTablesEmptyDirs").toLowerCase().equals("true"))
|
||||||
|
sarcCreateTablesEmptyDirs = true;
|
||||||
|
else
|
||||||
|
sarcCreateTablesEmptyDirs = false;
|
||||||
|
if (parser.get("sarcDownloadReports").toLowerCase().equals("true"))
|
||||||
|
sarcDownloadReports = true;
|
||||||
|
else
|
||||||
|
sarcDownloadReports = false;
|
||||||
|
if (parser.get("sarcProcessStats").toLowerCase().equals("true"))
|
||||||
|
sarcProcessStats = true;
|
||||||
|
else
|
||||||
|
sarcProcessStats = false;
|
||||||
|
sarcNumberOfOpendoarsToDownload = Integer.parseInt(parser.get("sarcNumberOfOpendoarsToDownload"));
|
||||||
|
|
||||||
UsageStatsExporter usagestatsExport = new UsageStatsExporter();
|
UsageStatsExporter usagestatsExport = new UsageStatsExporter();
|
||||||
usagestatsExport.export();
|
usagestatsExport.export();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,22 @@ public class SarcStats {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reCreateLogDirs() throws IOException {
|
||||||
|
FileSystem dfs = FileSystem.get(new Configuration());
|
||||||
|
|
||||||
|
logger.info("Deleting sarcsReport (Array) directory: " + ExecuteWorkflow.sarcsReportPathArray);
|
||||||
|
dfs.delete(new Path(ExecuteWorkflow.sarcsReportPathArray), true);
|
||||||
|
|
||||||
|
logger.info("Deleting sarcsReport (NonArray) directory: " + ExecuteWorkflow.sarcsReportPathNonArray);
|
||||||
|
dfs.delete(new Path(ExecuteWorkflow.sarcsReportPathNonArray), true);
|
||||||
|
|
||||||
|
logger.info("Creating sarcsReport (Array) directory: " + ExecuteWorkflow.sarcsReportPathArray);
|
||||||
|
dfs.mkdirs(new Path(ExecuteWorkflow.sarcsReportPathArray));
|
||||||
|
|
||||||
|
logger.info("Creating sarcsReport (NonArray) directory: " + ExecuteWorkflow.sarcsReportPathNonArray);
|
||||||
|
dfs.mkdirs(new Path(ExecuteWorkflow.sarcsReportPathNonArray));
|
||||||
|
}
|
||||||
|
|
||||||
public void processSarc(String sarcsReportPathArray, String sarcsReportPathNonArray,
|
public void processSarc(String sarcsReportPathArray, String sarcsReportPathNonArray,
|
||||||
String url, String issn) throws Exception {
|
String url, String issn) throws Exception {
|
||||||
Statement stmt = ConnectDB.getHiveConnection().createStatement();
|
Statement stmt = ConnectDB.getHiveConnection().createStatement();
|
||||||
|
@ -353,8 +369,6 @@ public class SarcStats {
|
||||||
* ".json")); wr.print(text); wr.close();
|
* ".json")); wr.print(text); wr.close();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
System.out.println("AAAAAAAAAAA text " + text);
|
|
||||||
|
|
||||||
JSONParser parser = new JSONParser();
|
JSONParser parser = new JSONParser();
|
||||||
JSONObject jsonObject = null;
|
JSONObject jsonObject = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -60,12 +60,6 @@ public class UsageStatsExporter {
|
||||||
logger.info("Deleting portalLog directory: " + ExecuteWorkflow.portalLogPath);
|
logger.info("Deleting portalLog directory: " + ExecuteWorkflow.portalLogPath);
|
||||||
dfs.delete(new Path(ExecuteWorkflow.portalLogPath), true);
|
dfs.delete(new Path(ExecuteWorkflow.portalLogPath), true);
|
||||||
|
|
||||||
logger.info("Deleting sarcsReport (Array) directory: " + ExecuteWorkflow.sarcsReportPathArray);
|
|
||||||
dfs.delete(new Path(ExecuteWorkflow.sarcsReportPathArray), true);
|
|
||||||
|
|
||||||
logger.info("Deleting sarcsReport (NonArray) directory: " + ExecuteWorkflow.sarcsReportPathNonArray);
|
|
||||||
dfs.delete(new Path(ExecuteWorkflow.sarcsReportPathNonArray), true);
|
|
||||||
|
|
||||||
logger.info("Deleting lareferenciaLog directory: " + ExecuteWorkflow.lareferenciaLogPath);
|
logger.info("Deleting lareferenciaLog directory: " + ExecuteWorkflow.lareferenciaLogPath);
|
||||||
dfs.delete(new Path(ExecuteWorkflow.lareferenciaLogPath), true);
|
dfs.delete(new Path(ExecuteWorkflow.lareferenciaLogPath), true);
|
||||||
|
|
||||||
|
@ -75,12 +69,6 @@ public class UsageStatsExporter {
|
||||||
logger.info("Creating portalLog directory: " + ExecuteWorkflow.portalLogPath);
|
logger.info("Creating portalLog directory: " + ExecuteWorkflow.portalLogPath);
|
||||||
dfs.mkdirs(new Path(ExecuteWorkflow.portalLogPath));
|
dfs.mkdirs(new Path(ExecuteWorkflow.portalLogPath));
|
||||||
|
|
||||||
logger.info("Creating sarcsReport (Array) directory: " + ExecuteWorkflow.sarcsReportPathArray);
|
|
||||||
dfs.mkdirs(new Path(ExecuteWorkflow.sarcsReportPathArray));
|
|
||||||
|
|
||||||
logger.info("Creating sarcsReport (NonArray) directory: " + ExecuteWorkflow.sarcsReportPathNonArray);
|
|
||||||
dfs.mkdirs(new Path(ExecuteWorkflow.sarcsReportPathNonArray));
|
|
||||||
|
|
||||||
logger.info("Creating lareferenciaLog directory: " + ExecuteWorkflow.lareferenciaLogPath);
|
logger.info("Creating lareferenciaLog directory: " + ExecuteWorkflow.lareferenciaLogPath);
|
||||||
dfs.mkdirs(new Path(ExecuteWorkflow.lareferenciaLogPath));
|
dfs.mkdirs(new Path(ExecuteWorkflow.lareferenciaLogPath));
|
||||||
}
|
}
|
||||||
|
@ -161,11 +149,18 @@ public class UsageStatsExporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
|
|
||||||
// SarcStats sarcStats = new SarcStats();
|
SarcStats sarcStats = new SarcStats();
|
||||||
// sarcStats.getAndProcessSarc(sarcsReportPathArray, sarcsReportPathNonArray);
|
if (ExecuteWorkflow.sarcCreateTablesEmptyDirs) {
|
||||||
// sarcStats.finalizeSarcStats();
|
sarcStats.reCreateLogDirs();
|
||||||
// log.info("sarc done");
|
}
|
||||||
|
if (ExecuteWorkflow.sarcDownloadReports) {
|
||||||
|
sarcStats.getAndProcessSarc(ExecuteWorkflow.sarcsReportPathArray, ExecuteWorkflow.sarcsReportPathNonArray);
|
||||||
|
}
|
||||||
|
if (ExecuteWorkflow.sarcProcessStats) {
|
||||||
|
sarcStats.finalizeSarcStats();
|
||||||
|
}
|
||||||
|
logger.info("Sarc done");
|
||||||
|
|
||||||
// // finalize usagestats
|
// // finalize usagestats
|
||||||
// piwikstatsdb.finalizeStats();
|
// piwikstatsdb.finalizeStats();
|
||||||
|
|
|
@ -172,5 +172,29 @@
|
||||||
"paramLongName": "irusNumberOfOpendoarsToDownload",
|
"paramLongName": "irusNumberOfOpendoarsToDownload",
|
||||||
"paramDescription": "Limit the number of the downloaded Opendoars (Irus) to the first irusNumberOfOpendoarsToDownload",
|
"paramDescription": "Limit the number of the downloaded Opendoars (Irus) to the first irusNumberOfOpendoarsToDownload",
|
||||||
"paramRequired": true
|
"paramRequired": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"paramName": "icted",
|
||||||
|
"paramLongName": "sarcCreateTablesEmptyDirs",
|
||||||
|
"paramDescription": "Sarc section: Create tables and empty JSON directories?",
|
||||||
|
"paramRequired": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"paramName": "idr",
|
||||||
|
"paramLongName": "sarcDownloadReports",
|
||||||
|
"paramDescription": "Sarc section: Download reports?",
|
||||||
|
"paramRequired": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"paramName": "ipr",
|
||||||
|
"paramLongName": "sarcProcessStats",
|
||||||
|
"paramDescription": "Sarc section: Process stats?",
|
||||||
|
"paramRequired": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"paramName": "inod",
|
||||||
|
"paramLongName": "sarcNumberOfOpendoarsToDownload",
|
||||||
|
"paramDescription": "Limit the number of the downloaded Opendoars (Sarc) to the first sarcNumberOfOpendoarsToDownload",
|
||||||
|
"paramRequired": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -71,6 +71,10 @@
|
||||||
<arg>--irusDownloadReports</arg><arg>${irusDownloadReports}</arg>
|
<arg>--irusDownloadReports</arg><arg>${irusDownloadReports}</arg>
|
||||||
<arg>--irusProcessStats</arg><arg>${irusProcessStats}</arg>
|
<arg>--irusProcessStats</arg><arg>${irusProcessStats}</arg>
|
||||||
<arg>--irusNumberOfOpendoarsToDownload</arg><arg>${irusNumberOfOpendoarsToDownload}</arg>
|
<arg>--irusNumberOfOpendoarsToDownload</arg><arg>${irusNumberOfOpendoarsToDownload}</arg>
|
||||||
|
<arg>--sarcCreateTablesEmptyDirs</arg><arg>${sarcCreateTablesEmptyDirs}</arg>
|
||||||
|
<arg>--sarcDownloadReports</arg><arg>${sarcDownloadReports}</arg>
|
||||||
|
<arg>--sarcProcessStats</arg><arg>${sarcProcessStats}</arg>
|
||||||
|
<arg>--sarcNumberOfOpendoarsToDownload</arg><arg>${sarcNumberOfOpendoarsToDownload}</arg>
|
||||||
<capture-output/>
|
<capture-output/>
|
||||||
</java>
|
</java>
|
||||||
<ok to="End" />
|
<ok to="End" />
|
||||||
|
|
Loading…
Reference in New Issue