Skip to content

Commit

Permalink
feat: allow running updater as one-off job
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Dec 4, 2023
1 parent 70560ab commit 8657ecc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion runUpdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ SPARQL_URL=$HOST/$CONTEXT/namespace/$NAMESPACE/sparql
echo "Updating via $SPARQL_URL"
exec java -cp ${CLASSPATH} ${GC_LOGS} ${LOG_OPTIONS} ${EXTRA_JVM_OPTS} \
${TIMEOUT_ARG} ${UPDATER_OPTS} \
${MAIN} ${ARGS} --sparqlUrl ${SPARQL_URL} "$@"
${MAIN} ${ARGS} "$@"
13 changes: 1 addition & 12 deletions runUpdateWbStack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,4 @@ set -e
# Call runUpdate with all of the magic stuff that is in there for logging and JVM etc
# But don't actually pass any real arguments into Java
# Also pass in our custom Main class that will handle the "magic"
# TODO also pass class path in...
./runUpdate.sh \
-m org.wikidata.query.rdf.tool.WbStackUpdate \
-h IGNOREDHOST \
-n IGNOREDNAMESPACE \
-- \
--wikibaseHost IGNOREDWIKIBASEHOST \
--wikibaseScheme IGNOREDSCHEME \
--conceptUri IGNOREDCONCEPTURI \
--entityNamespaces IGNOREDENTITYNS \
--ids IGNOREDIDS

./runUpdate.sh -m org.wikidata.query.rdf.tool.WbStackUpdate "$@"
11 changes: 11 additions & 0 deletions src/main/java/org/wikidata/query/rdf/tool/WbStackUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ public static void main(String[] args) throws InterruptedException, IOException
setValuesFromEnvOrDie();
setSingleUseServicesAndObjects();

if (args.length != 0) {
boolean success = runUpdaterWithArgs(args);
closeSingleUseServicesAndObjects();
if (!success) {
System.err.println("Failed to run update command.");
System.exit(1);
}
System.err.println("Successfully ran update command.");
return;
}

int loopCount = 0;
long apiLastCalled;

Expand Down

0 comments on commit 8657ecc

Please sign in to comment.