Skip to content

Commit

Permalink
add seco
Browse files Browse the repository at this point in the history
  • Loading branch information
CalvinKirs committed Dec 4, 2023
1 parent a466a4f commit 99e69d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,12 @@ public class Config extends ConfigBase {
+ "the value should be greater than 0, if it is <=0, default is 5."})
public static int job_mtmv_task_consumer_thread_num = 10;

/* job test config */
/**
* If set to true, we will allow the interval unit to be set to second, when creating a recurring job.
*/
public static boolean enable_job_schedule_second_for_test = false;

/*---------------------- JOB CONFIG END------------------------*/
/**
* The number of async tasks that can be queued. @See TaskDisruptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.doris.catalog.Env;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.Config;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.UserException;
Expand Down Expand Up @@ -138,6 +139,10 @@ public void analyze(Analyzer analyzer) throws UserException {
if (null == intervalUnit) {
throw new AnalysisException("invalid interval time unit " + intervalTimeUnit);
}
if (intervalUnit.equals(IntervalUnit.SECOND)
&& !Config.enable_job_schedule_second_for_test) {
throw new AnalysisException("interval time unit can not be week");
}
timerDefinition.setIntervalUnit(intervalUnit);
}
if (null != startsTimeStamp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.function.Function;

public enum IntervalUnit {

SECOND("second", 0L, TimeUnit.SECONDS::toMillis),
MINUTE("minute", 0L, TimeUnit.MINUTES::toMillis),
HOUR("hour", 0L, TimeUnit.HOURS::toMillis),
DAY("day", 0L, TimeUnit.DAYS::toMillis),
Expand Down

0 comments on commit 99e69d6

Please sign in to comment.