Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

creating the new mock decorator and updating the config file #49

Merged
merged 27 commits into from
Feb 8, 2024

Conversation

hrushikesh-s
Copy link
Member

@hrushikesh-s hrushikesh-s commented Nov 23, 2023

Summary

Include a summary of major changes in bullet points:

  • Feature 1: custom Mock decorator that mocks the class and its methods using unittest.mock
  • Feature 2: all the device objects in alab_one that need to talk to the A-lab hardware (using API calls) have been mocked using a combination of get_driver() & connect() methods
  • Feature 3: simulation tag added to CLI command in alab_management
  • Fix 1: A-lab ecosystem can now be simulated just by programmatically chaining "alabos sim_mode --on" CLI command with "alabos launch" CLI command while launching the alab_management UI

Checklist

Before a pull request can be merged, the following items must be checked:

  • Code is in the standard Python style.
    The easiest way to handle this is to run the following in the correct sequence on
    your local machine. Start with running black on your new code. This will
    automatically reformat your code to PEP8 conventions and removes most issues. Then run
    pycodestyle, followed by flake8.
  • Docstrings have been added in theNumpy docstring format.
    Run pydocstyle on your code.
  • Type annotations are highly encouraged. Run mypy to
    type check your code.
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass.

@hrushikesh-s
Copy link
Member Author

hrushikesh-s commented Dec 1, 2023

This PR is ready for merging in master
@idocx @bernardusrendy @mattmcdermott

@@ -83,7 +78,56 @@ def __init__(self):
) from exc

self._path = Path(config_path).absolute()
self._config = freeze_config(_config)
# self._config = freeze_config(_config)
Copy link
Member

Choose a reason for hiding this comment

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

#TODO: remove the private token

@@ -22,8 +22,8 @@ class Sample:
task_id: Optional[ObjectId]
name: str
position: Optional[str]
metadata: Optional[Dict[str, Any]] = field(default_factory=dict)
tags: Optional[List[str]] = field(default_factory=list)
metadata: Optional[Dict[str, Any]] = field(default_factory=lambda: None)
Copy link
Member

Choose a reason for hiding this comment

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

Why cannot it default to list/dict? That should be easier for searching in the MongoDB.

the config file can now be toggled depending on whether or not the workflow is run under the "simulation" mode.
2. removed the redundancy caused by two alab_management config files
3. removed redundant --sim_mode flags from cli
@hrushikesh-s
Copy link
Member Author

@idocx @bernardusrendy, can you pls review this PR and merge if possible?

@idocx idocx merged commit 1a4d697 into CederGroupHub:master Feb 8, 2024
5 checks passed
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.

2 participants