-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move S3 file configuration to SingularityService
- Loading branch information
Showing
14 changed files
with
312 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
SingularityBase/src/main/java/com/hubspot/singularity/SingularityS3UploaderFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.hubspot.singularity; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.common.base.Optional; | ||
|
||
public class SingularityS3UploaderFile { | ||
private final String filename; | ||
private final Optional<String> s3UploaderBucket; | ||
private final Optional<String> s3UploaderKeyPattern; | ||
private final Optional<String> s3UploaderFilenameHint; | ||
private final Optional<String> directory; | ||
|
||
@JsonCreator | ||
public static SingularityS3UploaderFile fromString(String value) { | ||
return new SingularityS3UploaderFile(value, Optional.<String>absent(), Optional.<String>absent(), Optional.<String>absent(), Optional.<String>absent()); | ||
} | ||
|
||
@JsonCreator | ||
public SingularityS3UploaderFile(@JsonProperty("filename") String filename, | ||
@JsonProperty("s3UploaderBucket") Optional<String> s3UploaderBucket, | ||
@JsonProperty("s3UploaderKeyPattern") Optional<String> s3UploaderKeyPattern, | ||
@JsonProperty("s3UploaderFilenameHint") Optional<String> s3UploaderFilenameHint, | ||
@JsonProperty("directory") Optional<String> directory) { | ||
this.filename = filename; | ||
this.s3UploaderBucket = s3UploaderBucket; | ||
this.s3UploaderKeyPattern = s3UploaderKeyPattern; | ||
this.s3UploaderFilenameHint = s3UploaderFilenameHint; | ||
this.directory = directory; | ||
} | ||
|
||
public String getFilename() { | ||
return filename; | ||
} | ||
|
||
public Optional<String> getS3UploaderBucket() { | ||
return s3UploaderBucket; | ||
} | ||
|
||
public Optional<String> getS3UploaderKeyPattern() { | ||
return s3UploaderKeyPattern; | ||
} | ||
|
||
public Optional<String> getS3UploaderFilenameHint() { | ||
return s3UploaderFilenameHint; | ||
} | ||
|
||
public Optional<String> getDirectory() { | ||
return directory; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SingularityExecutorS3UploaderAdditionalFile[" + | ||
"filename='" + filename + '\'' + | ||
", s3UploaderBucket=" + s3UploaderBucket + | ||
", s3UploaderKeyPattern=" + s3UploaderKeyPattern + | ||
", s3UploaderFilenameHint=" + s3UploaderFilenameHint + | ||
", directory=" + directory + | ||
']'; | ||
} | ||
} |
110 changes: 110 additions & 0 deletions
110
SingularityBase/src/main/java/com/hubspot/singularity/SingularityTaskExecutorData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package com.hubspot.singularity; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.common.base.Optional; | ||
import com.hubspot.deploy.EmbeddedArtifact; | ||
import com.hubspot.deploy.ExecutorData; | ||
import com.hubspot.deploy.ExternalArtifact; | ||
import com.hubspot.deploy.S3Artifact; | ||
import com.hubspot.deploy.S3ArtifactSignature; | ||
import com.hubspot.singularity.executor.SingularityExecutorLogrotateFrequency; | ||
|
||
public class SingularityTaskExecutorData extends ExecutorData { | ||
private final List<SingularityS3UploaderFile> s3UploaderAdditionalFiles; | ||
private final String defaultS3Bucket; | ||
private final String s3UploaderKeyPattern; | ||
private final String serviceLog; | ||
private final String serviceFinishedTailLog; | ||
|
||
public SingularityTaskExecutorData(ExecutorData executorData, List<SingularityS3UploaderFile> s3UploaderAdditionalFiles, String defaultS3Bucket, String s3UploaderKeyPattern, String serviceLog, String serviceFinishedTailLog) { | ||
this(executorData.getCmd(), | ||
executorData.getEmbeddedArtifacts(), | ||
executorData.getExternalArtifacts(), | ||
executorData.getS3Artifacts(), | ||
executorData.getSuccessfulExitCodes(), | ||
executorData.getUser(), | ||
executorData.getRunningSentinel(), | ||
executorData.getExtraCmdLineArgs(), | ||
executorData.getLoggingTag(), | ||
executorData.getLoggingExtraFields(), | ||
executorData.getSigKillProcessesAfterMillis(), | ||
executorData.getMaxTaskThreads(), | ||
executorData.getPreserveTaskSandboxAfterFinish(), | ||
executorData.getMaxOpenFiles(), | ||
executorData.getSkipLogrotateAndCompress(), | ||
executorData.getS3ArtifactSignatures(), | ||
executorData.getLogrotateFrequency(), | ||
s3UploaderAdditionalFiles, | ||
defaultS3Bucket, | ||
s3UploaderKeyPattern, | ||
serviceLog, | ||
serviceFinishedTailLog); | ||
} | ||
|
||
@JsonCreator | ||
public SingularityTaskExecutorData(@JsonProperty("cmd") String cmd, | ||
@JsonProperty("embeddedArtifacts") List<EmbeddedArtifact> embeddedArtifacts, | ||
@JsonProperty("externalArtifacts") List<ExternalArtifact> externalArtifacts, | ||
@JsonProperty("s3Artifacts") List<S3Artifact> s3Artifacts, | ||
@JsonProperty("successfulExitCodes") List<Integer> successfulExitCodes, | ||
@JsonProperty("user") Optional<String> user, | ||
@JsonProperty("runningSentinel") Optional<String> runningSentinel, | ||
@JsonProperty("extraCmdLineArgs") List<String> extraCmdLineArgs, | ||
@JsonProperty("loggingTag") Optional<String> loggingTag, | ||
@JsonProperty("loggingExtraFields") Map<String, String> loggingExtraFields, | ||
@JsonProperty("sigKillProcessesAfterMillis") Optional<Long> sigKillProcessesAfterMillis, | ||
@JsonProperty("maxTaskThreads") Optional<Integer> maxTaskThreads, | ||
@JsonProperty("preserveTaskSandboxAfterFinish") Optional<Boolean> preserveTaskSandboxAfterFinish, | ||
@JsonProperty("maxOpenFiles") Optional<Integer> maxOpenFiles, | ||
@JsonProperty("skipLogrotateAndCompress") Optional<Boolean> skipLogrotateAndCompress, | ||
@JsonProperty("s3ArtifactSignatures") Optional<List<S3ArtifactSignature>> s3ArtifactSignatures, | ||
@JsonProperty("logrotateFrequency") Optional<SingularityExecutorLogrotateFrequency> logrotateFrequency, | ||
@JsonProperty("s3UploaderAdditionalFiles") List<SingularityS3UploaderFile> s3UploaderAdditionalFiles, | ||
@JsonProperty("defaultS3Bucket") String defaultS3Bucket, | ||
@JsonProperty("s3UploaderKeyPattern") String s3UploaderKeyPattern, | ||
@JsonProperty("serviceLog") String serviceLog, | ||
@JsonProperty("serviceFinishedTailLog") String serviceFinishedTailLog) { | ||
super(cmd, embeddedArtifacts, externalArtifacts, s3Artifacts, successfulExitCodes, user, runningSentinel, extraCmdLineArgs, loggingTag, loggingExtraFields, | ||
sigKillProcessesAfterMillis, maxTaskThreads, preserveTaskSandboxAfterFinish, maxOpenFiles, skipLogrotateAndCompress, s3ArtifactSignatures, logrotateFrequency); | ||
this.s3UploaderAdditionalFiles = s3UploaderAdditionalFiles; | ||
this.defaultS3Bucket = defaultS3Bucket; | ||
this.s3UploaderKeyPattern = s3UploaderKeyPattern; | ||
this.serviceLog = serviceLog; | ||
this.serviceFinishedTailLog = serviceFinishedTailLog; | ||
} | ||
|
||
public List<SingularityS3UploaderFile> getS3UploaderAdditionalFiles() { | ||
return s3UploaderAdditionalFiles; | ||
} | ||
|
||
public String getDefaultS3Bucket() { | ||
return defaultS3Bucket; | ||
} | ||
|
||
public String getS3UploaderKeyPattern() { | ||
return s3UploaderKeyPattern; | ||
} | ||
|
||
public String getServiceLog() { | ||
return serviceLog; | ||
} | ||
|
||
public String getServiceFinishedTailLog() { | ||
return serviceFinishedTailLog; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SingularityTaskExecutorData{" + | ||
"s3UploaderAdditionalFiles=" + s3UploaderAdditionalFiles + | ||
", defaultS3Bucket='" + defaultS3Bucket + '\'' + | ||
", s3UploaderKeyPattern='" + s3UploaderKeyPattern + '\'' + | ||
", serviceLog='" + serviceLog + '\'' + | ||
", serviceFinishedTailLog='" + serviceFinishedTailLog + '\'' + | ||
"} " + super.toString(); | ||
} | ||
} |
Oops, something went wrong.