Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NomadGUI
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Instrument Control
NomadGUI
Commits
87305935
Commit
87305935
authored
3 years ago
by
legoc
Browse files
Options
Downloads
Patches
Plain Diff
Added logs transfer Cameo app
parent
990c0d63
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pom.xml
+1
-1
1 addition, 1 deletion
pom.xml
src/main/java/fr/ill/ics/apps/LogsTransfer.java
+51
-0
51 additions, 0 deletions
src/main/java/fr/ill/ics/apps/LogsTransfer.java
src/main/java/fr/ill/ics/apps/LogsTransferCaller.java
+57
-0
57 additions, 0 deletions
src/main/java/fr/ill/ics/apps/LogsTransferCaller.java
with
109 additions
and
1 deletion
pom.xml
+
1
−
1
View file @
87305935
...
...
@@ -3,7 +3,7 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
fr.ill.ics
</groupId>
<artifactId>
nomadgui
</artifactId>
<version>
4.0.12
7
</version>
<version>
4.0.12
8-SNAPSHOT
</version>
<name>
NomadGUI
</name>
<description>
Graphical user interface for Nomad
</description>
<scm>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/fr/ill/ics/apps/LogsTransfer.java
0 → 100644
+
51
−
0
View file @
87305935
package
fr.ill.ics.apps
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.FileSystems
;
import
java.nio.file.Files
;
import
fr.ill.ics.cameo.Application
;
import
fr.ill.ics.cameo.Application.This
;
public
class
LogsTransfer
{
public
static
void
main
(
String
[]
args
)
{
This
.
init
(
args
);
try
{
String
logsPath
=
args
[
0
];
// Executing the command in the nomadgui-release directory.
String
command
=
"zip -r /tmp/logs.zip "
+
logsPath
;
String
[]
commandList
=
command
.
split
(
" "
);
ProcessBuilder
builder
=
new
ProcessBuilder
(
commandList
);
try
{
Process
scriptProcess
=
builder
.
start
();
scriptProcess
.
waitFor
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
InterruptedException
e
)
{
}
// Reading the resulting file.
byte
[]
fileContent
=
Files
.
readAllBytes
(
FileSystems
.
getDefault
().
getPath
(
"/tmp/logs.zip"
));
// Set the result.
This
.
setResult
(
fileContent
);
System
.
out
.
println
(
"Logs sent in result "
+
fileContent
.
length
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
// Do not forget to terminate This.
Application
.
This
.
terminate
();
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/fr/ill/ics/apps/LogsTransferCaller.java
0 → 100644
+
57
−
0
View file @
87305935
package
fr.ill.ics.apps
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
fr.ill.ics.cameo.Application
;
import
fr.ill.ics.cameo.Application.Instance
;
import
fr.ill.ics.cameo.Application.This
;
import
fr.ill.ics.cameo.Server
;
public
class
LogsTransferCaller
{
public
static
void
main
(
String
[]
args
)
{
This
.
init
(
args
);
if
(
args
.
length
<
1
)
{
System
.
out
.
println
(
"Usage: <server endpoint>"
);
System
.
exit
(
1
);
}
try
{
// Get the Cameo server.
Server
server
=
null
;
// The server endpoint is the first argument.
server
=
new
Server
(
args
[
0
]);
// Start the app.
Instance
app
=
server
.
start
(
"logstransfer"
);
app
.
waitFor
();
System
.
out
.
println
(
"Application finished"
);
System
.
out
.
println
(
"Application has result: "
+
app
.
hasResult
());
byte
[]
fileContent
=
app
.
getBinaryResult
();
System
.
out
.
println
(
"Got file content "
+
fileContent
.
length
);
// Write the file content.
File
file
=
new
File
(
"/tmp/nomadlogs.zip"
);
Files
.
write
(
file
.
toPath
(),
fileContent
);
System
.
out
.
println
(
"Wrote file /tmp/nomadlogs.zip"
);
server
.
terminate
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
// Do not forget to terminate This.
Application
.
This
.
terminate
();
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment