Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ejercicio2-framework-back
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Josue
ejercicio2-framework-back
Commits
31fd50ae
Commit
31fd50ae
authored
Jan 12, 2022
by
Roberto Loayza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SchedulerService
parent
9a719f6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
ScheduleService.java
...com/bytesw/bytebot/etl/batch/service/ScheduleService.java
+6
-11
No files found.
src/main/java/com/bytesw/bytebot/etl/batch/service/ScheduleService.java
View file @
31fd50ae
...
...
@@ -65,7 +65,7 @@ import java.util.concurrent.ScheduledFuture;
@Log4j2
@Component
@EnableScheduling
@EnableSchedulerLock
(
defaultLockAtMostFor
=
"PT
30S
"
)
@EnableSchedulerLock
(
defaultLockAtMostFor
=
"PT
15M
"
)
public
class
ScheduleService
implements
SchedulingConfigurer
{
ScheduledTaskRegistrar
scheduledTaskRegistrar
;
...
...
@@ -202,12 +202,6 @@ public class ScheduleService implements SchedulingConfigurer {
}
else
{
timeZone
=
TimeZone
.
getTimeZone
(
zoneDefault
);
}
Trigger
trigger
=
new
CronTrigger
(
cronExpression
,
timeZone
);
/* ETL de Dashboard */
String
key
=
String
.
format
(
"%s-%s"
,
tenantIdentifier
,
identifier
);
futureMap
.
put
(
key
,
taskRegistrar
.
getScheduler
().
schedule
(()
->
scheduleCron
(
createJob
(),
tenantIdentifier
),
trigger
));
/* Extraer el id del proceso - Delete */
ProcessETL
processDelete
=
processETLRepository
.
findByName
(
ProcessETLEnum
.
PROCESS_DELETE
.
getName
());
...
...
@@ -351,17 +345,18 @@ public class ScheduleService implements SchedulingConfigurer {
/* Métodos utilizados para ETL de dashboard */
@Scheduled
(
cron
=
"${application.byte-bot.batch.cron}"
)
@SchedulerLock
(
name
=
"
processJob"
,
lockAtLeastFor
=
"30S"
,
lockAtMostFor
=
"4
0S"
)
protected
Job
createJob
()
{
@SchedulerLock
(
name
=
"
Dashboard-ETL"
,
lockAtLeastFor
=
"PT40S"
,
lockAtMostFor
=
"PT5
0S"
)
protected
void
createJob
()
{
List
<
Agent
>
agentDeployed
=
agentRepository
.
findByStatus
(
AgentStatusEnum
.
DEPLOYED
);
log
.
info
(
"INICIADO"
);
if
(!
agentDeployed
.
isEmpty
())
{
ThreadLocalStorage
.
setTenantName
(
tenant
);
return
jobBuilderFactory
.
get
(
"processJob"
)
Job
job
=
jobBuilderFactory
.
get
(
"processJob"
)
.
incrementer
(
new
RunIdIncrementer
()).
listener
(
listener
)
.
flow
(
createStep
(
tenant
)).
end
().
build
();
scheduleCron
(
job
,
tenant
);
}
else
{
log
.
info
(
"No hay agentes deployados."
);
return
null
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment