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

Configure cache dir #1712

Merged
merged 3 commits into from
Dec 17, 2021
Merged

Conversation

devinrsmith
Copy link
Member

We should not be writing to a container's /tmp directory in docker, unless it's a docker volume.

Our docker images declare a /cache volume, so we should:

  1. Set -Djava.io.tmpdir=/cache/tmp so that any java code using temporary files will inherit a docker volume backed tmp space
  2. Introduce -Ddeephaven.cache.dir so that those who want more explicit "cache" space (instead of "tmp" space), can take advantage of it. (Only AbstractScriptSession atm, but others could use it in the future.)

deephaven.console.type=groovy
deephaven.cache.dir=/cache
java.io.tmpdir=/cache/tmp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this a sub-dir of the host's /tmp?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Punting - #1714

private static final Path cacheDir;

static {
final String deephavenCacheDir = System.getProperty(DEEPHAVEN_CACHE_DIR);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configuration.getInstance().getPropertyWithDefault?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ this is not an existing method. But I can use Configuration, sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, method is io.deephaven.configuration.PropertyFile#getStringWithDefault.

@@ -61,7 +60,7 @@ protected AbstractScriptSession(@Nullable Listener changeListener, boolean isDef
this.changeListener = changeListener;

final UUID scriptCacheId = UuidCreator.getRandomBased();
classCacheDirectory = new File(CLASS_CACHE_LOCATION, UuidCreator.toString(scriptCacheId));
classCacheDirectory = CLASS_CACHE_LOCATION.resolve(UuidCreator.toString(scriptCacheId)).toFile();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed introducing props:
INSTANCE_ID (if set, this is the ID)
INSTANCE_ID_FILE (if set and INSTANCE_ID isn't this is the file we load from or generate)
else, we randomly allocate an instance ID and be sure to clean up on exit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Punting - #1713

rcaudy
rcaudy previously approved these changes Dec 17, 2021
@devinrsmith devinrsmith merged commit 170e336 into deephaven:main Dec 17, 2021
@devinrsmith devinrsmith deleted the config/cache-dir branch December 17, 2021 17:31
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants