-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Catalog item flags & OCI spot instances (#118)
- Introduce the concept of catalog item flags so that items that break compatibility are only returned when their flags are queried explicitly. - Add OCI spot instances as an example of catalog items with flags. - Publish new catalogs under the /v2 prefix. - Convert /v2 catalogs to /v1 catalogs for legacy users. /v1 catalogs will not have any items with flags, as they can potentially break compatibility.
- Loading branch information
Showing
16 changed files
with
267 additions
and
38 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
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
Empty file.
Empty file.
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,31 @@ | ||
import argparse | ||
import logging | ||
from collections.abc import Sequence | ||
from pathlib import Path | ||
from textwrap import dedent | ||
from typing import Optional | ||
|
||
from gpuhunt._internal import storage | ||
from gpuhunt._internal.utils import configure_logging | ||
|
||
|
||
def main(args: Optional[Sequence[str]] = None): | ||
configure_logging() | ||
parser = argparse.ArgumentParser( | ||
description=dedent( | ||
""" | ||
Convert a v2 catalog to a v1 catalog. Legacy v1 catalogs are used by older | ||
gpuhunt versions that do not respect the `flags` field. Any catalog items | ||
with flags are filtered out when converting to v1. | ||
""" | ||
) | ||
) | ||
parser.add_argument("--input", type=Path, required=True, help="The v2 catalog file to read") | ||
parser.add_argument("--output", type=Path, required=True, help="The v1 catalog file to write") | ||
args = parser.parse_args(args) | ||
storage.convert_catalog_v2_to_v1(path_v2=args.input, path_v1=args.output) | ||
logging.info("Converted %s -> %s", args.input, args.output) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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.