Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
bilby
bilby
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 29
    • Issues 29
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 14
    • Merge Requests 14
  • Requirements
    • Requirements
    • List
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • lscsoft
  • bilbybilby
  • Merge Requests
  • !920

Merged
Created Feb 19, 2021 by Matthew David Pitkin@matthew-pitkinDeveloper

utils.py: explicitly convert module keys to a list

  • Overview 0
  • Commits 1
  • Pipelines 1
  • Changes 1

For some reason when I locally run my test suite for CWInPy it fails when using the loaded_modules_dict function in utils.py. The error given is:

cwinpy/hierarchical.py:1428: in sample
    self._result = bilby.run_sampler(
../../miniconda3/envs/cwinpy/lib/python3.8/site-packages/bilby/core/sampler/__init__.py:145: in run_sampler
    meta_data["loaded_modules"] = loaded_modules_dict()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def loaded_modules_dict():
        module_names = sys.modules.keys()
        vdict = {}
        print(module_names)
>       for key in module_names:
E       RuntimeError: dictionary changed size during iteration

../../miniconda3/envs/cwinpy/lib/python3.8/site-packages/bilby/core/utils.py:1277: RuntimeError

so it's complaining about a dictionary size changing during the loop.

I seem to be able to fix this by explicitly setting:

module_names = list(sys.modules.keys())

I'm not sure why I'm seeing the error, but this fix seems to be otherwise harmless.

Assignee
Assign to
Reviewer
Request review from
1.1.0
Milestone
1.1.0
Assign milestone
Time tracking
Source branch: loadedmodules