feat(cache): add read-only cache inspection command (sebs resources inspect) - #310
feat(cache): add read-only cache inspection command (sebs resources inspect)#310sanskar-singh-2403 wants to merge 1 commit into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change adds offline cache inspection APIs, a ChangesCache inspection
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Operator
participant resources_inspect
participant Cache
participant ResourceInspectorApp
Operator->>resources_inspect: invoke resources inspect
resources_inspect->>Cache: load cached benchmarks and resources
Cache-->>resources_inspect: return inspection data
resources_inspect->>ResourceInspectorApp: provide benchmark and resource data
ResourceInspectorApp->>ResourceInspectorApp: group data by cloud and resource class
ResourceInspectorApp-->>Operator: render interactive inventory
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@sebs/cache.py`:
- Around line 1004-1006: Update add_code_package and update_code_package to
validate Docker availability for container packages at method entry, before
creating cache directories or copying/deleting code. Replace the Docker-client
assert with a RuntimeError, and move cache_dir creation until after this
validation so failures cannot leave partial cache entries.
In `@sebs/cli.py`:
- Around line 927-929: Update the emptiness check in the allocated-resource loop
to also consider the `allocated_ports` field, so entries containing only ports
are retained; continue skipping entries only when resources, storage buckets,
and allocated ports are all absent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d5e5aa5c-5045-432a-95fa-71c5e9e61254
📒 Files selected for processing (3)
sebs/cache.pysebs/cli.pytests/test_cache_inspect.py
e242c16 to
74db93e
Compare
|
@coderabbitai help |
ChatThere are 3 ways to chat with CodeRabbit:
CodeRabbit commands
Other keywords and placeholders
CodeRabbit configuration file (
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
sebs/cache.py (1)
525-635: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsolidate the hardcoded cloud list into
SUPPORTED_CLOUDS.
SUPPORTED_CLOUDSduplicates the["azure", "aws", "gcp", "openwhisk", "local"]literal already used inload_config(line 267) andshutdown(line 315). Now there are three copies of the same list; a future change (adding/removing a supported cloud) risks silently missing one of them.♻️ Proposed consolidation
def load_config(self) -> None: with self._lock: - for cloud in ["azure", "aws", "gcp", "openwhisk", "local"]: + for cloud in self.SUPPORTED_CLOUDS: cloud_config_file = os.path.join(self.cache_dir, "{}.json".format(cloud))def shutdown(self) -> None: if self.config_updated: with self._lock: - for cloud in ["azure", "aws", "gcp", "openwhisk", "local"]: + for cloud in self.SUPPORTED_CLOUDS: if cloud in self.cached_config:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/cache.py` around lines 525 - 635, Reuse the class-level SUPPORTED_CLOUDS constant in load_config and shutdown instead of their duplicated hardcoded cloud lists. Update those cloud-iteration or validation paths to reference SUPPORTED_CLOUDS so future supported-cloud changes apply consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@sebs/cache.py`:
- Around line 525-635: Reuse the class-level SUPPORTED_CLOUDS constant in
load_config and shutdown instead of their duplicated hardcoded cloud lists.
Update those cloud-iteration or validation paths to reference SUPPORTED_CLOUDS
so future supported-cloud changes apply consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a55b6c63-32e0-4295-9b2d-a578aa8109b3
📒 Files selected for processing (3)
sebs/cache.pysebs/cli.pytests/test_cache_inspect.py
74db93e to
fb17cbc
Compare
|
@CodeRabbit review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
sebs/cache.py (2)
528-636: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify redundant key-check before dict access.
Ruff (RUF019) flags the
"containers" in lang_cfg and lang_cfg["containers"]/"code_package" in lang_cfg and lang_cfg["code_package"]patterns at lines 608 and 610 —dict.get(...)already returns a falsy default, so the membership check is redundant.♻️ Suggested tweak
- if "containers" in lang_cfg and lang_cfg["containers"]: + if lang_cfg.get("containers"): packaging = "container" - elif "code_package" in lang_cfg and lang_cfg["code_package"]: + elif lang_cfg.get("code_package"): packaging = "code_package"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/cache.py` around lines 528 - 636, Update packaging detection in get_deployed_benchmarks to use lang_cfg.get("containers") and lang_cfg.get("code_package") directly as truthiness checks, removing the redundant membership tests while preserving the existing container, code_package, and unknown precedence.Source: Linters/SAST tools
161-163: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueClass-level mutable list attribute.
Ruff flags
SUPPORTED_CLOUDSas a mutable default at class scope (RUF012). It's only iterated today, but annotating asClassVar(or using aTuple) makes the immutability intent explicit and future-proofs against accidental in-place mutation.♻️ Suggested tweak
- # Cloud platforms that own a per-cloud cache file (`<cloud>.json`). - SUPPORTED_CLOUDS: List[str] = ["azure", "aws", "gcp", "openwhisk", "local"] + # Cloud platforms that own a per-cloud cache file (`<cloud>.json`). + SUPPORTED_CLOUDS: ClassVar[Tuple[str, ...]] = ("azure", "aws", "gcp", "openwhisk", "local")🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/cache.py` around lines 161 - 163, Update the SUPPORTED_CLOUDS class attribute to declare class-level ownership and prevent mutable-default linting, using ClassVar with an immutable tuple or another immutable representation. Preserve the existing cloud values and iteration behavior.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@sebs/cache.py`:
- Around line 528-636: Update packaging detection in get_deployed_benchmarks to
use lang_cfg.get("containers") and lang_cfg.get("code_package") directly as
truthiness checks, removing the redundant membership tests while preserving the
existing container, code_package, and unknown precedence.
- Around line 161-163: Update the SUPPORTED_CLOUDS class attribute to declare
class-level ownership and prevent mutable-default linting, using ClassVar with
an immutable tuple or another immutable representation. Preserve the existing
cloud values and iteration behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 83639dca-bfae-41e3-906d-26624b4eb8ad
📒 Files selected for processing (3)
sebs/cache.pysebs/cli.pytests/test_cache_inspect.py
|
@mcopik this pr is ready to be reviewed, let me know your thoughts, Thanks! |
|
@sanskar-singh-2403 Thank you for the help and contribution! It is much appreciated :) I think this is a great first step, but it's not complete for #306. When we mention "TUI", we mean a TUI that is an interactive visualizer and displays the resources. The interface part is important because in a complex experiment, you might have many different resources allocated. Having a TUI that groups them according to cloud system and resource class will be necessary, as a regular CLI printout will be too busy. |
how does these look to you @mcopik |
fb17cbc to
76c661f
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (10)
sebs/tui/inspect.py (2)
230-234: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the redundant container around the detail table.
Horizontal(id="detail")wraps a singleDataTable. The id can move to the table, or the container can become aVerticalif a second detail widget is planned.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/tui/inspect.py` around lines 230 - 234, Remove the redundant Horizontal container with id "detail" around the single DataTable in the inspect view, and assign the "detail" id directly to the DataTable while preserving its existing zebra_stripes and cursor_type settings.
73-77: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider skipping clouds that have no resources.
get_allocated_resourcesreturns an entry for every supported cloud that has a cache file, even when the resource block is empty._clouds_in_usethen adds a cloud node whose classes are all empty. The static table path filters such entries, so the two output modes disagree.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/tui/inspect.py` around lines 73 - 77, Update the cloud iteration in the inspection output flow to skip clouds whose allocated resource mapping is empty, matching the static table behavior. Use the existing resources value from allocated.get(cloud, {}) before creating the cloud node and its RESOURCE_CLASSES entries, while preserving clouds that have actual resources.tests/test_cache_inspect.py (1)
181-199: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the Docker guard.
_require_docker_clientis new behavior that raisesRuntimeErrorwhen a container package is cached without a Docker client. No test exercises it. A small test that callsadd_code_packagewith a container variant on aCachebuilt without a client would lock in the guard and confirm that no cache directory is created.Do you want me to generate this test?
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_cache_inspect.py` around lines 181 - 199, Add a focused test alongside test_inspection_is_read_only that creates Cache without a Docker client, calls add_code_package with a container package variant, and asserts RuntimeError is raised. Also verify no cache directory or persisted cache state is created after the failed operation.sebs/cache.py (3)
620-626: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify the packaging detection.
Ruff reports RUF019 for the key check before the dictionary access.
dict.getgives the same result.♻️ Proposed change
functions = lang_cfg.get("functions") or {} - if "containers" in lang_cfg and lang_cfg["containers"]: + if lang_cfg.get("containers"): packaging = "container" - elif "code_package" in lang_cfg and lang_cfg["code_package"]: + elif lang_cfg.get("code_package"): packaging = "code_package" else: packaging = "unknown"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/cache.py` around lines 620 - 626, Update the packaging detection logic near the functions assignment to use dictionary get-based truthiness checks for both "containers" and "code_package", removing the redundant key-existence checks while preserving the existing packaging values and precedence.Source: Linters/SAST tools
162-163: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAnnotate
SUPPORTED_CLOUDSas a class-level constant.Ruff reports RUF012 for the mutable class attribute. Use
ClassVar(and optionally a tuple) so the shared list cannot be reassigned or mutated per instance.♻️ Proposed change
- SUPPORTED_CLOUDS: List[str] = ["azure", "aws", "gcp", "openwhisk", "local"] + SUPPORTED_CLOUDS: ClassVar[List[str]] = ["azure", "aws", "gcp", "openwhisk", "local"]Add
ClassVarto thetypingimport.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/cache.py` around lines 162 - 163, Update the cache class’s SUPPORTED_CLOUDS declaration to use a ClassVar annotation, adding ClassVar to the typing imports; preferably use an immutable tuple so the shared cloud list cannot be mutated or reassigned per instance.Source: Linters/SAST tools
611-618: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueConsider a positive language test instead of a deny list.
The loop treats every dict-valued key except
storageandnosqlas a language. If a new non-language key is added under a deployment, the inspector reports it as a benchmark row with packagingunknown. A positive check, for example requiring one offunctions,code_package, orcontainers, keeps the view correct as the cache schema grows.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/cache.py` around lines 611 - 618, Update the language filtering in the dep_cfg iteration to accept only dictionary entries containing at least one recognized language marker: functions, code_package, or containers. Remove the deny-list reliance on storage and nosql while preserving the existing handling for non-dictionary entries, so new deployment-level keys are not emitted as language benchmark rows.tests/test_tui_inspect.py (1)
94-94: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReplace the single-element slices with
next(...).Ruff reports RUF015 at three places in this file.
next(...)states the intent and avoids building an intermediate list.♻️ Proposed change
- http = [t for t in triggers if t["type"] == "http"][0] + http = next(t for t in triggers if t["type"] == "http") @@ - aws_node = [n for n in tree.root.children if str(n.label) == "aws"][0] - bench_node = [ - n for n in aws_node.children if str(n.label).startswith("Benchmarks") - ][0] + aws_node = next(n for n in tree.root.children if str(n.label) == "aws") + bench_node = next( + n for n in aws_node.children if str(n.label).startswith("Benchmarks") + )Also applies to: 125-128
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_tui_inspect.py` at line 94, Replace the three single-element list comprehensions indexed with [0] in tests/test_tui_inspect.py, including the assignment around the http trigger and the occurrences near lines 125–128, with next(...) over the corresponding iterables. Preserve each existing filter predicate and selected element while avoiding intermediate list construction.Source: Linters/SAST tools
pyproject.toml (1)
42-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueKeep the Textual dependency declaration consistent across both manifests. Both files declare
textual>=0.50.0as a required dependency, butsebs/cli.pyimportssebs.tuilazily, which shows the TUI is optional. Whatever you decide about an optional extra and an upper version bound must be applied in both places, or the two manifests drift.
pyproject.toml#L42-L42: movetextual>=0.50.0into an optional extra such astui, or keep it required and add an upper bound.requirements.txt#L23-L23: apply the same decision so that the pip requirements file matches the project metadata.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pyproject.toml` at line 42, Make the Textual dependency policy consistent in pyproject.toml at lines 42-42 and requirements.txt at lines 23-23: either move textual>=0.50.0 into the same optional tui extra in both manifests, or keep it required with the same upper version bound in both. Ensure sebs/cli.py’s lazy sebs.tui import remains compatible with the chosen declaration.sebs/cli.py (2)
897-901: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winFall back to the table output when stdout is not a terminal.
The default mode is
tui. If a user pipes the command or runs it in CI, an interactive Textual app is not usable. The docstring already states that onlytableandjsonare safe for non-TTY environments. Detect the terminal and downgrade automatically.♻️ Proposed change
- if output_format == "tui": + if output_format == "tui" and not sys.stdout.isatty(): + output_format = "table" + + if output_format == "tui": from sebs.tui import run_inspector run_inspector(benchmarks, allocated) returnImport
sysat the top of the module if it is not already imported.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/cli.py` around lines 897 - 901, Update the output-format handling around the `run_inspector` call to detect whether `sys.stdout` is a TTY; when `output_format` is `tui` but stdout is not a terminal, switch to the documented safe `table` output instead of launching the interactive inspector. Import `sys` at module scope if needed, while preserving TUI behavior for terminal output and existing JSON handling.
855-860: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDerive the platform choices from
Cache.SUPPORTED_CLOUDS.The literal list repeats the constant added in
sebs/cache.py. If a platform is added there, this list silently drifts and the filter rejects a valid platform.♻️ Proposed change
- type=click.Choice(["azure", "aws", "gcp", "local", "openwhisk"]), + type=click.Choice(sorted(Cache.SUPPORTED_CLOUDS)),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sebs/cli.py` around lines 855 - 860, Update the deployment click option to derive its Choice values from Cache.SUPPORTED_CLOUDS instead of maintaining the duplicated literal list, while preserving the existing default and help text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@sebs/cli.py`:
- Around line 849-854: Update the --cache click.option in the cache inspection
command to remove exists=True while retaining the directory-only and readable
constraints. Ensure a missing cache path reaches the existing empty-cache
handling, avoiding unnecessary directory creation for this read-only command if
Cache initialization would create it.
- Around line 933-956: Align the --output table behavior with the command’s
documented fields by either adding columns and row values for NoSQL tables and
resource groups in the res_table construction and allocated iteration, or
narrowing the command docstring to remove those fields; keep the documentation
and rendered output consistent.
---
Nitpick comments:
In `@pyproject.toml`:
- Line 42: Make the Textual dependency policy consistent in pyproject.toml at
lines 42-42 and requirements.txt at lines 23-23: either move textual>=0.50.0
into the same optional tui extra in both manifests, or keep it required with the
same upper version bound in both. Ensure sebs/cli.py’s lazy sebs.tui import
remains compatible with the chosen declaration.
In `@sebs/cache.py`:
- Around line 620-626: Update the packaging detection logic near the functions
assignment to use dictionary get-based truthiness checks for both "containers"
and "code_package", removing the redundant key-existence checks while preserving
the existing packaging values and precedence.
- Around line 162-163: Update the cache class’s SUPPORTED_CLOUDS declaration to
use a ClassVar annotation, adding ClassVar to the typing imports; preferably use
an immutable tuple so the shared cloud list cannot be mutated or reassigned per
instance.
- Around line 611-618: Update the language filtering in the dep_cfg iteration to
accept only dictionary entries containing at least one recognized language
marker: functions, code_package, or containers. Remove the deny-list reliance on
storage and nosql while preserving the existing handling for non-dictionary
entries, so new deployment-level keys are not emitted as language benchmark
rows.
In `@sebs/cli.py`:
- Around line 897-901: Update the output-format handling around the
`run_inspector` call to detect whether `sys.stdout` is a TTY; when
`output_format` is `tui` but stdout is not a terminal, switch to the documented
safe `table` output instead of launching the interactive inspector. Import `sys`
at module scope if needed, while preserving TUI behavior for terminal output and
existing JSON handling.
- Around line 855-860: Update the deployment click option to derive its Choice
values from Cache.SUPPORTED_CLOUDS instead of maintaining the duplicated literal
list, while preserving the existing default and help text.
In `@sebs/tui/inspect.py`:
- Around line 230-234: Remove the redundant Horizontal container with id
"detail" around the single DataTable in the inspect view, and assign the
"detail" id directly to the DataTable while preserving its existing
zebra_stripes and cursor_type settings.
- Around line 73-77: Update the cloud iteration in the inspection output flow to
skip clouds whose allocated resource mapping is empty, matching the static table
behavior. Use the existing resources value from allocated.get(cloud, {}) before
creating the cloud node and its RESOURCE_CLASSES entries, while preserving
clouds that have actual resources.
In `@tests/test_cache_inspect.py`:
- Around line 181-199: Add a focused test alongside test_inspection_is_read_only
that creates Cache without a Docker client, calls add_code_package with a
container package variant, and asserts RuntimeError is raised. Also verify no
cache directory or persisted cache state is created after the failed operation.
In `@tests/test_tui_inspect.py`:
- Line 94: Replace the three single-element list comprehensions indexed with [0]
in tests/test_tui_inspect.py, including the assignment around the http trigger
and the occurrences near lines 125–128, with next(...) over the corresponding
iterables. Preserve each existing filter predicate and selected element while
avoiding intermediate list construction.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5e81853f-5e2d-4887-9c04-35b4ebed7ff1
📒 Files selected for processing (8)
pyproject.tomlrequirements.txtsebs/cache.pysebs/cli.pysebs/tui/__init__.pysebs/tui/inspect.pytests/test_cache_inspect.pytests/test_tui_inspect.py
76c661f to
80be8ea
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@sebs/cli.py`:
- Around line 949-970: Update the static resource table row construction around
the allocated resource loop to count NoSQL tables from the matching benchmarks
rows’ row["nosql"] cached table names, rather than len(res.get("nosql") or {}),
while preserving the existing zero/default display behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7561dde6-c1e3-4bb5-882f-70ff89f9b176
📒 Files selected for processing (8)
pyproject.tomlrequirements.txtsebs/cache.pysebs/cli.pysebs/tui/__init__.pysebs/tui/inspect.pytests/test_cache_inspect.pytests/test_tui_inspect.py
🚧 Files skipped from review as they are similar to previous changes (3)
- pyproject.toml
- requirements.txt
- sebs/tui/init.py
80be8ea to
bf46c3f
Compare
|
@sanskar-singh-2403 Thanks for the update, looks much better. I guess we can then kill the tabular version in the CLI :) |
Add `sebs resources inspect` to visualize the on-disk cache without
contacting any cloud provider or requiring a Docker daemon.
- Extend sebs.cache.Cache with two read-only helpers:
- get_deployed_benchmarks(): flattens per-benchmark config.json files
into rows of (benchmark, platform, language, packaging, functions,
triggers, storage, nosql).
- get_allocated_resources(): reads the per-cloud files (aws.json,
local.json, ...) for resources_id, region, storage buckets, and
locally allocated ports.
- Make Cache docker_client optional so read-only consumers can open a
cache without a running Docker daemon; guard the container-caching
paths with an assertion.
- Add the `resources inspect` CLI command with a rich table view and a
--json output mode, plus an optional --deployment platform filter.
- Add offline unit tests that build a synthetic cache directory.
Addresses spcl#306.
bf46c3f to
c24c16e
Compare
done |




Summary
Adds
sebs resources inspect, a read-only command that visualizes theon-disk cache without contacting any cloud provider or requiring a Docker
daemon. Addresses #306.
Per the discussion on the issue, this extends the existing
sebs.cache.CacheAPI rather than introducing a separate inspection layer,and lives as a subcommand under the existing
resourcescommand group.What it shows
(container vs code_package), number of functions, and trigger types.
resources_id, region, storagebucket count, and locally allocated ports.
Changes
sebs.cache.Cachewith two read-only helpers:get_deployed_benchmarks(): flattens the per-benchmarkconfig.jsonfiles into rows of (benchmark, platform, language, packaging,
functions, triggers, storage, nosql).
get_allocated_resources(): reads the per-cloud files (aws.json,local.json, ...) forresources_id, region, storage buckets, andlocally allocated ports.
Cachedocker_clientoptional so read-only consumers can open acache without a running Docker daemon; guard the container-caching paths
with an assertion.
resources inspectCLI command with a rich table view and a--jsonoutput mode, plus an optional--deploymentplatform filter.Usage
Test plan
--deploymentfilter against a real cacheAddresses #306.