Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
ab113789
Commit
ab113789
authored
12 years ago
by
jakubs
Browse files
Options
Downloads
Patches
Plain Diff
BIS-85 SP-217 Maintenance task to compute intensity level. Implement
batch-size SVN: 26387
parent
c2c9fd1e
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
screening/source/java/ch/systemsx/cisd/openbis/dss/etl/ComputeIntensityLevelTransformationsMaintenanceTask.java
+28
-2
28 additions, 2 deletions
.../ComputeIntensityLevelTransformationsMaintenanceTask.java
with
28 additions
and
2 deletions
screening/source/java/ch/systemsx/cisd/openbis/dss/etl/ComputeIntensityLevelTransformationsMaintenanceTask.java
+
28
−
2
View file @
ab113789
...
...
@@ -83,6 +83,8 @@ public class ComputeIntensityLevelTransformationsMaintenanceTask implements IMai
private
static
final
String
STATUS_FILENAME_KEY
=
"status-filename"
;
private
static
final
String
BATCH_SIZE_KEY
=
"batch-size"
;
private
boolean
computeMinMaxLevels
;
private
int
minLevel
;
...
...
@@ -99,6 +101,8 @@ public class ComputeIntensityLevelTransformationsMaintenanceTask implements IMai
private
boolean
isDefaultTransformation
;
private
int
batchSize
;
private
File
queueFile
;
/*
...
...
@@ -165,6 +169,12 @@ public class ComputeIntensityLevelTransformationsMaintenanceTask implements IMai
String
queueFilePath
=
PropertyUtils
.
getMandatoryProperty
(
properties
,
STATUS_FILENAME_KEY
);
queueFile
=
new
File
(
queueFilePath
);
batchSize
=
Integer
.
valueOf
(
properties
.
getProperty
(
BATCH_SIZE_KEY
,
"1"
));
if
(
batchSize
<
1
)
{
throw
new
ConfigurationFailureException
(
"Batch size must be at least 1"
);
}
}
/**
...
...
@@ -175,7 +185,6 @@ public class ComputeIntensityLevelTransformationsMaintenanceTask implements IMai
{
PersistentExtendedBlockingQueueDecorator
<
Long
>
queue
=
ExtendedBlockingQueueFactory
.<
Long
>
createSmartPersist
(
queueFile
);
try
{
executeTransformations
(
queue
);
...
...
@@ -188,8 +197,23 @@ public class ComputeIntensityLevelTransformationsMaintenanceTask implements IMai
private
void
executeTransformations
(
PersistentExtendedBlockingQueueDecorator
<
Long
>
queue
)
{
long
lastSeenId
=
getLastSeenIDFromQueue
(
queue
);
for
(
int
i
=
0
;
i
<
batchSize
;
i
++)
{
boolean
result
=
executeOnce
(
queue
);
if
(
false
==
result
)
{
return
;
}
}
}
/**
* Return true if there are still potentially datasets to process.
*/
private
boolean
executeOnce
(
PersistentExtendedBlockingQueueDecorator
<
Long
>
queue
)
{
long
lastSeenId
=
getLastSeenIDFromQueue
(
queue
);
Long
nextId
=
dao
.
tryGetNextDatasetId
(
lastSeenId
);
// if this value is null, it means there are no newer datasets
...
...
@@ -200,7 +224,9 @@ public class ComputeIntensityLevelTransformationsMaintenanceTask implements IMai
executeTransformations
(
nextId
);
}
storeLastSeenInTheQueue
(
queue
,
nextId
);
return
true
;
}
return
false
;
}
private
void
executeTransformations
(
long
datasetId
)
...
...
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