-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow slurm launcher to retrieve results after server restart (#754)
- Loading branch information
1 parent
3eb2ff8
commit 300e3b2
Showing
11 changed files
with
255 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging | ||
from pathlib import Path | ||
|
||
import click | ||
|
||
from antarest.tools.admin_lib import clean_locks as do_clean_locks | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@click.group() | ||
def commands() -> None: | ||
pass | ||
|
||
|
||
@commands.command() | ||
@click.option( | ||
"--config", | ||
"-c", | ||
nargs=1, | ||
required=True, | ||
type=click.Path(exists=True), | ||
help="Application config", | ||
) | ||
def clean_locks(config: str) -> None: | ||
"""Clean app locks""" | ||
do_clean_locks(Path(config)) | ||
|
||
|
||
if __name__ == "__main__": | ||
commands() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import logging | ||
from pathlib import Path | ||
|
||
from antarest.core.config import Config | ||
from antarest.core.utils.utils import get_local_path | ||
from antarest.launcher.adapters.slurm_launcher.slurm_launcher import ( | ||
WORKSPACE_LOCK_FILE_NAME, | ||
) | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def clean_locks_from_config(config: Config) -> None: | ||
if config.launcher.slurm: | ||
slurm_workspace = config.launcher.slurm.local_workspace | ||
if slurm_workspace.exists() and slurm_workspace.is_dir(): | ||
for workspace in slurm_workspace.iterdir(): | ||
lock_file = workspace / WORKSPACE_LOCK_FILE_NAME | ||
if lock_file.exists(): | ||
logger.info( | ||
f"Removing slurm workspace lock file {lock_file}" | ||
) | ||
lock_file.unlink() | ||
|
||
|
||
def clean_locks(config: Path) -> None: | ||
"""Clean app locks""" | ||
res = get_local_path() / "resources" | ||
config_obj = Config.from_yaml_file(res=res, file=config) | ||
clean_locks_from_config(config_obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.