Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functionality to dynamically determine date relative to current date #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The following variables are common to all storage layers:

* `SPARK_MASTER`: Spark master to submit the job to; Defaults to `local[*]`
* `DATE`: Date in YYYY-mm-dd format. Denotes a day for which dependency links will be created.
* `DATE_MINUS_DAYS`: If `DATE` is not set or passed in, this value is subtracted from the current date to determine the day for which dependency links will be created.

### Cassandra
Cassandra is used when `STORAGE=cassandra`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.time.Duration;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -35,6 +36,9 @@ public static void main(String[] args) throws UnsupportedEncodingException {
date = parseZonedDateTime(args[0]);
} else if (System.getenv("DATE") != null) {
date = parseZonedDateTime(System.getenv("DATE"));
} else if (System.getenv("DATE_MINUS_DAYS") != null && System.getenv("DATE_MINUS_DAYS").trim() != "") {
long days = Long.parseLong(System.getenv("DATE_MINUS_DAYS"));
date = date.minusDays(days);
}

run(storage, date);
Expand Down