datahub/wherehows-backend/app/msgs/EtlJobMessage.java
Mars Lan 53a30d5a77 Major refactoring of ETL scheduling & configuration (#542)
* Major refactoring
- Move job-spcific properties from wh_etl_job_property table to .job files
- Use the job file name instead of numeric IDs to identify ETL jobs
- Use reflection to create ETL job class at run time instead of relying hard-coded enums
- Drop ETL job-related APIs as they're no longer needed
- Drop wh_etl_job, wh_etl_job_property, wh_etl_job_execution tables
- Add wh_etl_schedule & wh_etl_history tables
2017-07-10 13:44:33 -07:00

78 lines
1.9 KiB
Java

/**
* Copyright 2015 LinkedIn Corp. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package msgs;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.Properties;
import metadata.etl.models.EtlType;
import metadata.etl.models.RefIdType;
import wherehows.common.Constant;
/**
* Created by zechen on 9/4/15.
*/
public class EtlJobMessage {
private static int DEFAULT_TIMEOUT = 20000;
private Long whEtlExecId;
private String etlJobName;
private Properties etlJobProperties;
public EtlJobMessage(String etlJobName, Properties etlJobProperties) {
this.etlJobName = etlJobName;
this.etlJobProperties = etlJobProperties;
}
public Long getWhEtlExecId() {
return whEtlExecId;
}
public void setWhEtlExecId(Long whEtlExecId) {
this.whEtlExecId = whEtlExecId;
}
public String getEtlJobName() {
return etlJobName;
}
public Properties getEtlJobProperties() {
return etlJobProperties;
}
public String getCmdParam() {
return etlJobProperties.getProperty(Constant.JOB_CMD_PARAMS_KEY, "");
}
public int getTimeout() {
String timeout = etlJobProperties.getProperty(Constant.JOB_TIMEOUT_KEY, null);
if (timeout == null) {
return DEFAULT_TIMEOUT;
}
return Integer.parseInt(timeout);
}
public String getCronExpr() {
return etlJobProperties.getProperty(Constant.JOB_CRON_EXPR_KEY, null);
}
/**
* For debuging
* @return
*/
public String toDebugString() {
return String.format("(jobName:%s, whEtlExecId:%d)", this.etlJobName, this.whEtlExecId);
}
}