@@ -371,18 +371,19 @@ protected void unprotectUpdateProgress() throws UserException {
371
371
}
372
372
373
373
@ Override
374
- protected void preCheckNeedSchedule () throws UserException {
374
+ protected boolean preCheckNeedSchedule (boolean isNeedAutoSchedule ) throws UserException {
375
375
// If user does not specify kafka partition,
376
376
// We will fetch partition from kafka server periodically
377
- if (this .state == JobState .RUNNING || this .state == JobState .NEED_SCHEDULE ) {
377
+ if (this .state == JobState .RUNNING || this .state == JobState .NEED_SCHEDULE || isNeedAutoSchedule ) {
378
378
if (customKafkaPartitions != null && !customKafkaPartitions .isEmpty ()) {
379
- return ;
379
+ return true ;
380
380
}
381
- updateKafkaPartitions ();
381
+ return updateKafkaPartitions ();
382
382
}
383
+ return true ;
383
384
}
384
385
385
- private void updateKafkaPartitions () throws UserException {
386
+ private boolean updateKafkaPartitions () throws UserException {
386
387
try {
387
388
this .newCurrentKafkaPartition = getAllKafkaPartitions ();
388
389
} catch (Exception e ) {
@@ -397,7 +398,9 @@ private void updateKafkaPartitions() throws UserException {
397
398
new ErrorReason (InternalErrorCode .PARTITIONS_ERR , msg ),
398
399
false /* not replay */ );
399
400
}
401
+ return false ;
400
402
}
403
+ return true ;
401
404
}
402
405
403
406
// if customKafkaPartition is not null, then return false immediately
@@ -406,7 +409,7 @@ private void updateKafkaPartitions() throws UserException {
406
409
// update current kafka partition at the same time
407
410
// current kafka partitions = customKafkaPartitions == 0 ? all partition of kafka topic : customKafkaPartitions
408
411
@ Override
409
- protected boolean unprotectNeedReschedule () throws UserException {
412
+ protected boolean unprotectNeedReschedule (boolean isNeedAutoSchedule ) throws UserException {
410
413
// only running and need_schedule job need to be changed current kafka partitions
411
414
if (this .state == JobState .RUNNING || this .state == JobState .NEED_SCHEDULE ) {
412
415
if (CollectionUtils .isNotEmpty (customKafkaPartitions )) {
@@ -447,11 +450,15 @@ protected boolean unprotectNeedReschedule() throws UserException {
447
450
}
448
451
449
452
}
453
+ return isNeedAutoSchedule ;
454
+ }
455
+
456
+ @ Override
457
+ protected boolean isNeedAutoSchedule () {
450
458
if (this .state == JobState .PAUSED ) {
451
459
return ScheduleRule .isNeedAutoSchedule (this );
452
460
}
453
461
return false ;
454
-
455
462
}
456
463
457
464
@ Override
0 commit comments