Skip to content

Handle NumPy values in workflow metadata - #579

Open
CAOShurong wants to merge 1 commit into
materialsproject:mainfrom
CAOShurong:codex/522-numpy-metadata
Open

CAOShurong wants to merge 1 commit into
materialsproject:mainfrom
CAOShurong:codex/522-numpy-metadata

Conversation

@CAOShurong

Copy link
Copy Markdown

Summary

  • recursively convert NumPy scalars and arrays in workflow metadata to BSON-compatible Python built-in values before persistence
  • preserve native datetime values and leave the in-memory workflow metadata unchanged
  • make the general FireWorks serializer retain NumPy scalar semantics instead of stringifying values such as numpy.bool_
  • add nested metadata, BSON encoding, immutability, datetime, and scalar regression coverage

Testing

  • python -m pytest fireworks/utilities/tests/test_fw_serializers.py fireworks/core/tests/test_firework.py -q (37 passed)
  • repository pre-commit hooks on all four changed files
  • non-MongoDB portable subset (94 passed, 56 skipped, 4 deselected); the excluded local-Windows files require Unix cat/echo/touch commands or a running MongoDB, and representative failures reproduce on the exact base commit
  • sdist and wheel build
  • clean-venv install of the wheel followed by nested numpy.bool_/integer/float/array Workflow.to_db_dict() and BSON.encode() round-trip probe
  • git diff --check

Closes #522

Disclosure: This contribution was developed with OpenAI Codex assistance. I reviewed the implementation and regression coverage.

Signed-off-by: CAOShurong <170531907+CAOShurong@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

bson.errors.InvalidDocument: cannot encode object: True, of type: <class 'numpy.bool_'>

1 participant