Skip to content

update dict to class attr#225

Open
ryanraaschCDC wants to merge 10 commits into
mainfrom
rr-154-class-props
Open

update dict to class attr#225
ryanraaschCDC wants to merge 10 commits into
mainfrom
rr-154-class-props

Conversation

@ryanraaschCDC

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors several Azure Batch model access patterns, replacing as_dict()/dict-style fallbacks with direct attribute or mapping-style access in order to rely on class attributes instead of serialized dictionaries.

Changes:

  • Updated job termination-reason extraction to use mapping-style access (.get(...)) instead of as_dict() fallback.
  • Updated pool mount configuration retrieval to use mount_configuration attribute access rather than dict-derived values.
  • Removed an old commented import and added a small initializer comment in _cloudclient.py.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
cfa/cloudops/batch_helpers.py Refactors job termination and pool mount/vm-size lookups away from as_dict()/dict fallbacks toward attribute access.
cfa/cloudops/_cloudclient.py Refactors pool-id discovery from job_info.as_dict() to mapping-style .get(...) access; small comment cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cfa/cloudops/batch_helpers.py Outdated
Comment thread cfa/cloudops/batch_helpers.py Outdated
Comment on lines 1074 to 1077
mc = getattr(pool_info, "mount_configuration", None)
if mc is None and hasattr(pool_info, "as_dict"):
pool_dict = pool_info.as_dict()
mc = (
pool_dict.get("mount_configuration")
or pool_dict.get("mountConfiguration")
or pool_dict.get("properties", {}).get("mountConfiguration")
or []
)
if mc is None:
mc = pool_info.mount_configuration or []
mc = mc or []
Comment thread cfa/cloudops/batch_helpers.py Outdated
Comment on lines 1207 to 1210
mc = getattr(pool_info, "mount_configuration", None)
if mc is None and hasattr(pool_info, "as_dict"):
pool_dict = pool_info.as_dict()
mc = (
pool_dict.get("mount_configuration")
or pool_dict.get("mountConfiguration")
or pool_dict.get("properties", {}).get("mountConfiguration")
or []
)
if mc is None:
mc = pool_info.mount_configuration or []
mc = mc or []
Comment thread cfa/cloudops/batch_helpers.py Outdated
Comment thread cfa/cloudops/_cloudclient.py Outdated
Comment thread cfa/cloudops/_cloudclient.py Outdated
Comment on lines 999 to 1006
if pool_name is None:
job_dict = job_info.as_dict()
exec_dict = job_dict.get("execution_info") or job_dict.get("executionInfo")
exec_dict = job_info.get("execution_info") or job_info.get("executionInfo")
if isinstance(exec_dict, dict):
pool_name = exec_dict.get("pool_id") or exec_dict.get("poolId")
if pool_name is None:
pool_dict = job_dict.get("pool_info") or job_dict.get("poolInfo")
pool_dict = job_info.get("pool_info") or job_info.get("poolInfo")
if isinstance(pool_dict, dict):
pool_name = pool_dict.get("pool_id") or pool_dict.get("poolId")
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

Comment thread my-dest-path Outdated
@ryanraaschCDC ryanraaschCDC marked this pull request as ready for review July 8, 2026 20:00
@ryanraaschCDC ryanraaschCDC requested a review from xop5 July 8, 2026 20:00
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.

use class properties rather than dict keys

4 participants