-
Notifications
You must be signed in to change notification settings - Fork 3
Use a more flexible cache directory #707
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
Changes from all commits
833db95
1213de2
e1c6c73
e853e12
059f888
2b049e5
45941f6
452f3f5
6d8e451
91c6110
b615fd0
157635f
c78b03a
aa59964
1aff631
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import os | ||
| from threading import Thread | ||
| from typing import Callable, Optional | ||
|
|
||
|
|
@@ -27,7 +26,6 @@ | |
| class FileTaskScheduler(TaskSchedulerBase): | ||
| def __init__( | ||
| self, | ||
| cache_directory: str = "executorlib_cache", | ||
| resource_dict: Optional[dict] = None, | ||
| execute_function: Callable = execute_with_pysqa, | ||
| terminate_function: Optional[Callable] = None, | ||
|
|
@@ -39,10 +37,10 @@ def __init__( | |
| Initialize the FileExecutor. | ||
|
|
||
| Args: | ||
| cache_directory (str, optional): The directory to store cache files. Defaults to "executorlib_cache". | ||
| resource_dict (dict): A dictionary of resources required by the task. With the following keys: | ||
| - cores (int): number of MPI cores to be used for each function call | ||
| - cwd (str/None): current working directory where the parallel python task is executed | ||
| - cache_directory (str): The directory to store cache files. | ||
| execute_function (Callable, optional): The function to execute tasks. Defaults to execute_in_subprocess. | ||
| terminate_function (Callable, optional): The function to terminate the tasks. | ||
| pysqa_config_directory (str, optional): path to the pysqa config directory (only for pysqa based backend). | ||
|
|
@@ -53,6 +51,7 @@ def __init__( | |
| default_resource_dict = { | ||
| "cores": 1, | ||
| "cwd": None, | ||
| "cache_directory": "executorlib_cache", | ||
| } | ||
| if resource_dict is None: | ||
| resource_dict = {} | ||
|
|
@@ -61,12 +60,10 @@ def __init__( | |
| ) | ||
| if execute_function == execute_in_subprocess and terminate_function is None: | ||
| terminate_function = terminate_subprocess | ||
| cache_directory_path = os.path.abspath(cache_directory) | ||
| self._process_kwargs = { | ||
| "resource_dict": resource_dict, | ||
| "future_queue": self._future_queue, | ||
| "execute_function": execute_function, | ||
| "cache_directory": cache_directory_path, | ||
| "resource_dict": resource_dict, | ||
| "terminate_function": terminate_function, | ||
| "pysqa_config_directory": pysqa_config_directory, | ||
| "backend": backend, | ||
|
|
@@ -81,11 +78,11 @@ def __init__( | |
|
|
||
|
|
||
| def create_file_executor( | ||
| resource_dict: dict, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify the breaking change is intentional and documented. The change from 🏁 Script executed: #!/bin/bash
# Description: Check if this breaking change is mentioned in documentation or changelog
# Expected: Find references to the API change in documentation files
# Search for documentation about this change
fd -e md -e rst -e txt -e py --exec grep -l "resource_dict" {} \; | head -10
echo "---"
# Look for changelog or migration docs
fd -e md -e rst -e txt -e py -I --exec grep -l -i "breaking\|changelog\|migration" {} \; | head -5Length of output: 608 Add documentation for the breaking change to I didn’t find any mentions of this API change in your documentation or changelog. Since making
🤖 Prompt for AI Agents |
||
| max_workers: Optional[int] = None, | ||
| backend: str = "flux_submission", | ||
| max_cores: Optional[int] = None, | ||
| cache_directory: Optional[str] = None, | ||
| resource_dict: Optional[dict] = None, | ||
| flux_executor=None, | ||
| flux_executor_pmi_mode: Optional[str] = None, | ||
| flux_executor_nesting: bool = False, | ||
|
|
@@ -96,8 +93,6 @@ def create_file_executor( | |
| init_function: Optional[Callable] = None, | ||
| disable_dependencies: bool = False, | ||
| ): | ||
| if cache_directory is None: | ||
| cache_directory = "executorlib_cache" | ||
| if block_allocation: | ||
| raise ValueError( | ||
| "The option block_allocation is not available with the pysqa based backend." | ||
|
|
@@ -106,14 +101,15 @@ def create_file_executor( | |
| raise ValueError( | ||
| "The option to specify an init_function is not available with the pysqa based backend." | ||
| ) | ||
| if cache_directory is not None: | ||
| resource_dict["cache_directory"] = cache_directory | ||
| check_flux_executor_pmi_mode(flux_executor_pmi_mode=flux_executor_pmi_mode) | ||
| check_max_workers_and_cores(max_cores=max_cores, max_workers=max_workers) | ||
| check_hostname_localhost(hostname_localhost=hostname_localhost) | ||
| check_executor(executor=flux_executor) | ||
| check_nested_flux_executor(nested_flux_executor=flux_executor_nesting) | ||
| check_flux_log_files(flux_log_files=flux_log_files) | ||
| return FileTaskScheduler( | ||
| cache_directory=cache_directory, | ||
| resource_dict=resource_dict, | ||
| pysqa_config_directory=pysqa_config_directory, | ||
| backend=backend.split("_submission")[0], | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.