Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Commit c220e07

Browse files
committed
Merge pull request #200 from spotify/rohan/date
Add date string to temporary job names
2 parents 2f08112 + 46a2e0b commit c220e07

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

helios-testing/src/main/java/com/spotify/helios/testing/JobPrefixFile.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import java.nio.channels.OverlappingFileLockException;
3333
import java.nio.file.Files;
3434
import java.nio.file.Path;
35+
import java.text.SimpleDateFormat;
36+
import java.util.Date;
3537
import java.util.concurrent.ThreadLocalRandom;
3638

3739
import static java.lang.Integer.toHexString;
@@ -122,7 +124,8 @@ public static JobPrefixFile tryFromExistingFile(final Path file) throws IOExcept
122124
private JobPrefixFile(final String prefix, final Path directory) throws IOException {
123125
Preconditions.checkNotNull(directory);
124126
this.prefix = prefix == null
125-
? "tmp_" + toHexString(ThreadLocalRandom.current().nextInt())
127+
? "tmp_" + new SimpleDateFormat("yyyyMMdd").format(new Date()) + "_"
128+
+ toHexString(ThreadLocalRandom.current().nextInt())
126129
: prefix;
127130

128131
// Make sure directory exists, then create prefix file

0 commit comments

Comments
 (0)