Skip to content

Commit

Permalink
granularly clear contents from rack
Browse files Browse the repository at this point in the history
  • Loading branch information
saratge committed Aug 22, 2023
1 parent a60d1a8 commit e72d6ad
Show file tree
Hide file tree
Showing 4 changed files with 420 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

import com.ge.research.rack.utils.ConnectionUtil;
import com.ge.research.rack.utils.RackConsole;
import com.ge.research.rack.views.ClearRackDialog;
import com.ge.research.rack.views.SelectDataGraphsDialog;
import com.ge.research.rack.views.ViewUtils;
import com.ge.research.semtk.nodeGroupStore.client.NodeGroupStoreRestClient;
import com.ge.research.semtk.resultSet.Table;
Expand All @@ -47,6 +49,7 @@
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.*;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.handlers.HandlerUtil;
Expand Down Expand Up @@ -109,8 +112,18 @@ public static void deleteAllNodegroups(IProgressMonitor monitor) throws Exceptio

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

try {

String queryNodegroup = "";

ClearRackDialog dialog =
new ClearRackDialog(
Display.getDefault().getActiveShell(), queryNodegroup);
dialog.run();


return null;

/* try {
String consoleViewId = IConsoleConstants.ID_CONSOLE_VIEW;
IConsoleView consoleView =
Expand Down Expand Up @@ -179,6 +192,6 @@ public void scheduled(IJobChangeEvent event) {}
e.printStackTrace();
}
return null;
return null; */
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

public class IngestInstanceDataHandler extends AbstractHandler {
private static String manifestPath = "";

private static volatile boolean isRunning = false;
private int uploadModelFromYAML(String yamlPath, IProgressMonitor monitor) throws Exception {
if (monitor.isCanceled()) {
return -1;
Expand Down Expand Up @@ -396,8 +396,9 @@ private int uploadNodegroupsFromCSV(

private int uploadDataFromManifestYAML(String yamlPath, IProgressMonitor monitor)
throws Exception {

if (monitor.isCanceled()) {


if (monitor.isCanceled()) {
return -1;
}
File file = new File(yamlPath);
Expand All @@ -419,6 +420,7 @@ private int uploadDataFromManifestYAML(String yamlPath, IProgressMonitor monitor
+ "/"
+ file.getName()
+ ", please check");

return -1;
}

Expand All @@ -427,6 +429,7 @@ private int uploadDataFromManifestYAML(String yamlPath, IProgressMonitor monitor
if (!yamlMap.containsKey("steps")) {
RackConsole.getConsole()
.warning(dir + "/" + file.getName() + " contains no ingestion step, done");

return -1;
}

Expand Down Expand Up @@ -523,18 +526,29 @@ private IStatus ingestInstanceData(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}



File ingestionYaml = new File(manifestPath);
if (!ingestionYaml.exists()) {
RackConsole.getConsole().warning("No manifest.yaml found, nothing to ingest");
return Status.CANCEL_STATUS;
}
try {
if(!isRunning()) {
setRunning(true);
}
else {
RackConsole.getConsole().error("Another manifest imnport in progress");
}
uploadDataFromManifestYAML(manifestPath, monitor);
monitor.worked(100);

} catch (Exception e) {
RackConsole.getConsole().error("Ingestion failed using manifest yaml");

}

setRunning(false);
return Status.OK_STATUS;
}

Expand Down Expand Up @@ -639,4 +653,13 @@ public void scheduled(IJobChangeEvent event) {}
job.schedule();
return null;
}

private static synchronized void setRunning(boolean status) {
isRunning = status;
}

public static boolean isRunning() {
return isRunning;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,31 @@ public static SparqlQueryClient getOntologyUploadClient() throws Exception {

return new SparqlQueryClient(qAuthConfig);
}


public static SparqlQueryClient getOntologyUploadClient(String graph) throws Exception {
String protocol = RackPreferencePage.getProtocol();
String server = RackPreferencePage.getServer();
int port = Integer.parseInt(RackPreferencePage.getQueryPort());
String sparqlQueryEndPoint = "/sparqlQueryService/uploadOwl";
String connURL = RackPreferencePage.getConnURL();
String connType = RackPreferencePage.getConnType();
String user = RackPreferencePage.getUser();
String password = RackPreferencePage.getPassword();
SparqlQueryAuthClientConfig qAuthConfig =
new SparqlQueryAuthClientConfig(
protocol,
server,
port,
sparqlQueryEndPoint,
connURL,
connType,
graph,
user,
password);

return new SparqlQueryClient(qAuthConfig);
}

public static SparqlQueryClient getDataGraphClient() throws Exception {
String protocol = RackPreferencePage.getProtocol();
Expand Down
Loading

0 comments on commit e72d6ad

Please sign in to comment.