ref 8819: Extend The Algorithms Importer to Manage Many Processes as Black Boxes
https://support.d4science.org/issues/8819 Updated the support Pre-Installed software git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@151220 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
19fef1b9c5
commit
7ce0d5ec45
|
@ -313,6 +313,9 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
logger.debug("SetMainCode(): " + itemDescription);
|
||||
Project project = SessionUtil.getProjectSession(httpRequest, serviceCredentials);
|
||||
if (project != null) {
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
String link = filesStorage.getPublicLink(serviceCredentials.getUserName(), itemDescription.getId());
|
||||
itemDescription.setPublicLink(link);
|
||||
project.setMainCode(new MainCode(itemDescription));
|
||||
project.setInputData(null);
|
||||
project.setProjectTarget(null);
|
||||
|
@ -348,6 +351,9 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
if (project.getProjectConfig().getProjectSupport() instanceof ProjectSupportBlackBox) {
|
||||
ProjectSupportBlackBox projectSupportBlackBox = (ProjectSupportBlackBox) project
|
||||
.getProjectConfig().getProjectSupport();
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
String link = filesStorage.getPublicLink(serviceCredentials.getUserName(), itemDescription.getId());
|
||||
itemDescription.setPublicLink(link);
|
||||
projectSupportBlackBox.setBinaryItem(itemDescription);
|
||||
SessionUtil.setProjectSession(httpRequest, serviceCredentials, project);
|
||||
logger.debug("Project: " + project);
|
||||
|
@ -355,6 +361,9 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
if (project.getProjectConfig().getProjectSupport() instanceof ProjectSupportBashEdit) {
|
||||
ProjectSupportBashEdit projectSupportBashEdit = (ProjectSupportBashEdit) project
|
||||
.getProjectConfig().getProjectSupport();
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
String link = filesStorage.getPublicLink(serviceCredentials.getUserName(), itemDescription.getId());
|
||||
itemDescription.setPublicLink(link);
|
||||
projectSupportBashEdit.setBinaryItem(itemDescription);
|
||||
SessionUtil.setProjectSession(httpRequest, serviceCredentials, project);
|
||||
logger.debug("Project: " + project);
|
||||
|
|
|
@ -64,9 +64,12 @@ public class GeneralPurposeScriptProducer {
|
|||
String URLtoSoftware) throws Exception {
|
||||
|
||||
String mainSoftwareName = mainSoftware;
|
||||
if (URLtoSoftware!=null) {
|
||||
mainSoftwareName = URLReader(URLtoSoftware);
|
||||
}
|
||||
//if (URLtoSoftware!=null) {
|
||||
// logger.debug("Reading main software from remote URL: "+URLtoSoftware);
|
||||
// mainSoftwareName = URLReader(URLtoSoftware);
|
||||
// logger.debug("Main software name: "+mainSoftwareName);
|
||||
//
|
||||
//}
|
||||
|
||||
String inputDeclaration = generateInputStrings(input, softwareType, mainSoftwareName);
|
||||
String processInvocation = generateExternalProcessInvokation(mainSoftwareName, input);
|
||||
|
|
|
@ -34,7 +34,6 @@ public class MainGenerator {
|
|||
private static final String R_MIMETYPE = "text/plain";
|
||||
private static final String R_DESCRIPTION = "R script for ";
|
||||
|
||||
|
||||
public void createMain(ServiceCredentials serviceCredentials, Project project, String remoteTemplateFile)
|
||||
throws StatAlgoImporterServiceException {
|
||||
|
||||
|
@ -77,13 +76,20 @@ public class MainGenerator {
|
|||
|
||||
Path producedScript = null;
|
||||
|
||||
if (project.getProjectConfig().getProjectSupport() instanceof ProjectSupportBashEdit){
|
||||
producedScript = s.generateScript(input, output, binarySoftware.getName(),
|
||||
project.getProjectConfig().getLanguage(), binarySoftware.getPublicLink());
|
||||
} else {
|
||||
// if (project.getProjectConfig().getProjectSupport() instanceof
|
||||
// ProjectSupportBashEdit){
|
||||
// logger.debug("Generate Script R with public link:
|
||||
// "+binarySoftware.getPublicLink());
|
||||
// producedScript = s.generateScript(input, output,
|
||||
// binarySoftware.getName(),
|
||||
// project.getProjectConfig().getLanguage(),
|
||||
// binarySoftware.getPublicLink());
|
||||
// } else {
|
||||
|
||||
logger.debug("Generate Script R");
|
||||
producedScript = s.generateScript(input, output, binarySoftware.getName(),
|
||||
project.getProjectConfig().getLanguage());
|
||||
}
|
||||
// }
|
||||
|
||||
if (producedScript == null || !Files.exists(producedScript)) {
|
||||
String error = "Error creating script: file not exists!";
|
||||
|
|
|
@ -60,10 +60,10 @@ public class CodeSave {
|
|||
private ItemDescription saveInWorkspace(Path tempFile, ServiceCredentials serviceCredentials, ItemDescription file,
|
||||
String folderId) throws StatAlgoImporterServiceException {
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
WorkspaceItem mainCodeItem;
|
||||
WorkspaceItem worksapceItem;
|
||||
|
||||
try {
|
||||
mainCodeItem = filesStorage.createItemOnWorkspace(serviceCredentials.getUserName(),
|
||||
worksapceItem = filesStorage.createItemOnWorkspace(serviceCredentials.getUserName(),
|
||||
Files.newInputStream(tempFile, StandardOpenOption.READ), file.getName(), ALGORITHM_DESCRIPTION,
|
||||
ALGORITHM_MIMETYPE, folderId);
|
||||
} catch (IOException e) {
|
||||
|
@ -71,17 +71,18 @@ public class CodeSave {
|
|||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
ItemDescription mainCode;
|
||||
ItemDescription item;
|
||||
try {
|
||||
mainCode = new ItemDescription(mainCodeItem.getId(), mainCodeItem.getName(),
|
||||
mainCodeItem.getOwner().getPortalLogin(), mainCodeItem.getPath(), mainCodeItem.getType().name());
|
||||
item = new ItemDescription(worksapceItem.getId(), worksapceItem.getName(),
|
||||
worksapceItem.getOwner().getPortalLogin(), worksapceItem.getPath(), worksapceItem.getType().name());
|
||||
item.setPublicLink(worksapceItem.getPublicLink(false));
|
||||
} catch (InternalErrorException e) {
|
||||
logger.error(e.getLocalizedMessage(),e);
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||
|
||||
}
|
||||
|
||||
return mainCode;
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue