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

Try to figure out where/how to insert the cache here #740

Draft
wants to merge 11 commits into
base: dev
Choose a base branch
from

Conversation

Oddant1
Copy link
Member

@Oddant1 Oddant1 commented Jan 10, 2024

Closes #730

@Oddant1 Oddant1 marked this pull request as draft January 10, 2024 00:07
@Oddant1
Copy link
Member Author

Oddant1 commented Jan 17, 2024

@ebolyen is this along the lines of what we want? It seems to be doing what we wanted. This isn't the part of the framework I'm most familiar with.

@ebolyen
Copy link
Member

ebolyen commented Jan 18, 2024

Almost, I would lift this logic up to qiime2.core.path.

Is the process pool the best place? It seems kind of reasonable, although it's looking less like a pool every day. The automated cleanup is a nice feature of it.

We should also test this with your parsl situation with the provenance path not showing up. My hunch is it will still work since there's a flufl lock, but worth confirming before we break everything.

@Oddant1
Copy link
Member Author

Oddant1 commented Jan 18, 2024

Yeah while we were messing with that I was wondering if this functionality would resolve that

@Oddant1
Copy link
Member Author

Oddant1 commented Jan 18, 2024

Ok so we do want to put this in __new__ for OwnedPath or something?

@Oddant1
Copy link
Member Author

Oddant1 commented Jan 18, 2024

Something like how it is now and stop passing in prefix? I had figured this would bork things pretty bad, but maybe not.

@ebolyen
Copy link
Member

ebolyen commented Jan 25, 2024

Yep, in theory that's all we should need to do.


cache = get_cache()
kwargs['prefix'] = os.path.join(cache.process_pool.path,
'q2-%s-' % cls.__name__)
Copy link
Member

Choose a reason for hiding this comment

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

Let's put this under a tmp/ directory in the process pool (creating if needed). Maybe there should be a helper on the cache itself to return the temp directory?

@Oddant1 Oddant1 self-assigned this Jan 25, 2024
@Oddant1
Copy link
Member Author

Oddant1 commented Jan 31, 2024

This does not work how I thought it did at all. The actual path is one of the args, and the prefix doesn't seem to do much if anything when passed up to pathlib.Path

@Oddant1
Copy link
Member Author

Oddant1 commented Jan 31, 2024

@ebolyen I think putting the cache usage in OutPath.__new__ does something closer to what you wanted.

@@ -92,14 +92,20 @@ def _destruct(cls, path):
else:
os.unlink(path)

def __new__(cls, dir=False, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

Where there any callers of this? I swear we set prefix in a lot of places for stuff like q2-provenance... although come to think of it, cache has probably eroded out most of those callsites, but there may still be a few left.

Copy link
Member Author

Choose a reason for hiding this comment

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

Only existing use is

self.path = qpath.OutPath(
and tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable OwnedPaths (i.e. FileFormat and DirectoryFormat with write mode) to initialize in a Cache
2 participants