Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpc-workflow-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIJI
hpc-workflow-manager
Commits
b15edaff
Commit
b15edaff
authored
7 years ago
by
Jan Kožusznik
Browse files
Options
Downloads
Patches
Plain Diff
optimize notification
parent
4b7b9420
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
haas-java-client/src/main/java/cz/it4i/fiji/haas_java_client/HaaSClient.java
+22
-26
22 additions, 26 deletions
...c/main/java/cz/it4i/fiji/haas_java_client/HaaSClient.java
with
22 additions
and
26 deletions
haas-java-client/src/main/java/cz/it4i/fiji/haas_java_client/HaaSClient.java
+
22
−
26
View file @
b15edaff
...
...
@@ -248,8 +248,10 @@ public class HaaSClient {
FileTransferMethodExt
ft
=
getFileTransfer
().
getFileTransferMethod
(
jobId
,
getSessionID
());
try
(
ScpClient
scpClient
=
getScpClient
(
ft
))
{
String
[]
files
=
getFileTransfer
().
listChangedFilesForJob
(
jobId
,
getSessionID
());
List
<
Long
>
fileSizes
=
getSizes
(
Arrays
.
asList
(
files
).
stream
()
.
map
(
filename
->
"'"
+
ft
.
getSharedBasepath
()
+
"/"
+
filename
+
"'"
).
collect
(
Collectors
.
toList
()),
List
<
Long
>
fileSizes
=
getSizes
(
Arrays
.
asList
(
files
).
stream
()
.
map
(
filename
->
"'"
+
ft
.
getSharedBasepath
()
+
"/"
+
filename
+
"'"
)
.
collect
(
Collectors
.
toList
()),
scpClient
,
new
P_ProgressNotifierDecorator4Size
(
notifier
));
final
long
totalFileSize
=
fileSizes
.
stream
().
mapToLong
(
i
->
i
.
longValue
()).
sum
();
int
[]
idx
=
{
0
};
...
...
@@ -268,10 +270,15 @@ public class HaaSClient {
@Override
public
void
dataTransfered
(
long
bytesTransfered
)
{
totalDownloaded
[
0
]
+=
bytesTransfered
;
fileDownloaded
[
0
]
+=
bytesTransfered
;
notifier
.
setCount
((
int
)
(
totalDownloaded
[
0
]
>>
10
),
(
int
)
(
totalFileSize
>>
10
));
notifier
.
setItemCount
((
int
)
(
fileDownloaded
[
0
]
>>
10
),
(
int
)
(
fileSizes
.
get
(
idx
[
0
])
>>
10
));
if
(
fileDownloaded
[
0
]
==
0
&&
bytesTransfered
==
0
)
{
notifier
.
setItemCount
(
1
,
1
);
}
else
{
totalDownloaded
[
0
]
+=
bytesTransfered
;
fileDownloaded
[
0
]
+=
bytesTransfered
;
notifier
.
setCount
((
int
)
(
totalDownloaded
[
0
]
>>
10
),
(
int
)
(
totalFileSize
>>
10
));
notifier
.
setItemCount
((
int
)
(
fileDownloaded
[
0
]
>>
10
),
(
int
)
(
fileSizes
.
get
(
idx
[
0
])
>>
10
));
}
}
});
...
...
@@ -287,9 +294,10 @@ public class HaaSClient {
}
}
private
List
<
Long
>
getSizes
(
List
<
String
>
asList
,
ScpClient
scpClient
,
ProgressNotifier
notifier
)
throws
JSchException
,
IOException
{
private
List
<
Long
>
getSizes
(
List
<
String
>
asList
,
ScpClient
scpClient
,
ProgressNotifier
notifier
)
throws
JSchException
,
IOException
{
List
<
Long
>
result
=
new
LinkedList
<>();
String
item
;
notifier
.
addItem
(
item
=
"Checking sizes"
);
for
(
String
lfile
:
asList
)
{
...
...
@@ -395,62 +403,50 @@ public class HaaSClient {
return
sessionID
;
}
private
class
P_ProgressNotifierDecorator4Size
extends
P_ProgressNotifierDecorator
{
private
class
P_ProgressNotifierDecorator4Size
extends
P_ProgressNotifierDecorator
{
private
static
final
int
SIZE_RATIO
=
20
;
public
P_ProgressNotifierDecorator4Size
(
ProgressNotifier
notifier
)
{
super
(
notifier
);
}
@Override
public
void
setItemCount
(
int
count
,
int
total
)
{
super
.
setItemCount
(
count
,
total
);
setCount
(
count
,
total
*
SIZE_RATIO
);
}
}
private
class
P_ProgressNotifierDecorator
implements
ProgressNotifier
{
private
class
P_ProgressNotifierDecorator
implements
ProgressNotifier
{
private
ProgressNotifier
notifier
;
public
P_ProgressNotifierDecorator
(
ProgressNotifier
notifier
)
{
super
();
this
.
notifier
=
notifier
;
}
public
void
setTitle
(
String
title
)
{
notifier
.
setTitle
(
title
);
}
public
void
setCount
(
int
count
,
int
total
)
{
notifier
.
setCount
(
count
,
total
);
}
public
void
addItem
(
Object
item
)
{
notifier
.
addItem
(
item
);
}
public
void
setItemCount
(
int
count
,
int
total
)
{
notifier
.
setItemCount
(
count
,
total
);
}
public
void
itemDone
(
Object
item
)
{
notifier
.
itemDone
(
item
);
}
public
void
done
()
{
notifier
.
done
();
}
...
...
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