Changed DatastapaceManager logs

This commit is contained in:
Giancarlo Panichi 2022-03-31 16:18:26 +02:00
parent 81c260646d
commit 4e22245042
1 changed files with 27 additions and 26 deletions

View File

@ -142,13 +142,14 @@ public class DataspaceManager implements Runnable {
}
public String uploadData(StoredData data, FolderContainer destinationFolder, boolean changename) throws Exception {
LOGGER.debug("Dataspace->Analysing " + data);
LOGGER.debug("Dataspace->Uploaddata:"
+ " [data={},destinationFolder={}, changename={}] ", data, destinationFolder,
changename);
// String filenameonwsString = WorkspaceUtil.getUniqueName(data.name,
// wsFolder);
String filenameonwsString = data.name;
if (changename)
filenameonwsString = String.format("%s_(%s)%s", data.name, data.computationId,
getExtension(data.payload));
filenameonwsString = String.format("%s_(%s)%s", data.name, data.computationId, getExtension(data.payload));
InputStream in = null;
String url = "";
@ -188,7 +189,7 @@ public class DataspaceManager implements Runnable {
// LOGGER.debug("Dataspace->final file name on ws " +
// data.name+" description "+data.description);
LOGGER.debug("Dataspace->WS OP saving the following file on the WS " + filenameonwsString);
LOGGER.debug("Dataspace->WS OP saving the following file on the WS: " + filenameonwsString);
Map<String, Object> properties = new LinkedHashMap<String, Object>();
properties.put(computation_id, data.computationId);
@ -203,9 +204,11 @@ public class DataspaceManager implements Runnable {
properties.put(payload, url);
FileContainer fileContainer = destinationFolder.uploadFile(in, filenameonwsString, data.description);
fileContainer.setMetadata(new Metadata(properties));
LOGGER.debug("Dataspace->WS OP file uploaded on WS: " + filenameonwsString);
Metadata metadata = new Metadata(properties);
fileContainer.setMetadata(metadata);
LOGGER.debug("Dataspace->WS OP file saved on the WS " + filenameonwsString);
LOGGER.debug("Dataspace->WS OP file set metadata: " + metadata);
url = fileContainer.getPublicLink().toString();
LOGGER.debug("Dataspace->WS OP url produced for the file " + url);
@ -395,10 +398,9 @@ public class DataspaceManager implements Runnable {
}
/*
* List<String> scopes = new ArrayList<String>();
* scopes.add(config.getGcubeScope());
* ws.createGcubeItem(computation.id, computation.operatorDescription,
* scopes, computation.user, itemType, properties,
* newcomputationFolder.getId());
* scopes.add(config.getGcubeScope()); ws.createGcubeItem(computation.id,
* computation.operatorDescription, scopes, computation.user, itemType,
* properties, newcomputationFolder.getId());
*/
newcomputationFolder.setMetadata(new Metadata(properties));
@ -509,7 +511,8 @@ public class DataspaceManager implements Runnable {
.getContainers().get(0);
LOGGER.debug("Dataspace->removing computation data");
List<ItemContainer<? extends Item>> wi = computationContainer.findByName(this.statusComputationName).getContainers();
List<ItemContainer<? extends Item>> wi = computationContainer.findByName(this.statusComputationName)
.getContainers();
if (!wi.isEmpty()) {
for (ItemContainer<? extends Item> container : wi) {
boolean retry = false;
@ -528,14 +531,12 @@ public class DataspaceManager implements Runnable {
LOGGER.debug("Dataspace->Warning Could not find {} under {}", this.statusComputationName,
computationContainer.get().getName());
/*
* TODO: ASK GIANPAOLO int maxtries = 3; int i =1; while
* (ws.exists(computation.id,computationsFolderWs.getId()) &&
* i<maxtries){
* LOGGER.debug("Dataspace->computation data still exist... retrying "+i
* ); Thread.sleep(1000);
* computationsFolderWs.find(computation.id).remove(); i++; }
* (ws.exists(computation.id,computationsFolderWs.getId()) && i<maxtries){
* LOGGER.debug("Dataspace->computation data still exist... retrying "+i );
* Thread.sleep(1000); computationsFolderWs.find(computation.id).remove(); i++;
* }
*/
LOGGER.debug("Dataspace->finished removing computation data ");