-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## Overview <https://opentrons.atlassian.net/browse/AUTH-73> <https://opentrons.atlassian.net/browse/RDEVOPS-71> ~~Examples only.~~ ~~This PR will not integrate these examples into the analyses snapshot.~~ ### I lied. --------- Co-authored-by: Derek Maggio <[email protected]>
- Loading branch information
1 parent
c4234b4
commit e64dca5
Showing
174 changed files
with
15,400 additions
and
1,280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.env | ||
results | ||
analysis_results/*.json | ||
files/generated_protocols/* | ||
!files/generated_protocols/.keepme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import os | ||
from typing import Optional | ||
|
||
from rich.console import Console | ||
from rich.panel import Panel | ||
|
||
from automation.data.protocol import Protocol | ||
from automation.data.protocol_with_overrides import ProtocolWithOverrides | ||
from automation.data.protocols import Protocols | ||
from automation.data.protocols_with_overrides import ProtocolsWithOverrides | ||
|
||
|
||
class ProtocolRegistry: | ||
def __init__(self) -> None: | ||
self.protocols: Protocols = Protocols() | ||
self.protocols_with_overrides: ProtocolsWithOverrides = ProtocolsWithOverrides() | ||
self.protocols_to_test: Optional[list[Protocol]] = self._what_protocols() | ||
|
||
def _what_protocols(self) -> Optional[list[Protocol]]: | ||
protocol_names: Optional[str] = os.environ.get("APP_ANALYSIS_TEST_PROTOCOLS") | ||
override_protocol_names: Optional[str] = os.environ.get("APP_ANALYSIS_TEST_PROTOCOLS_WITH_OVERRIDES") | ||
protocols_to_test: list[Protocol] = [] | ||
if protocol_names: | ||
for protocol_name in [x.strip() for x in protocol_names.split(",")]: | ||
protocol: Protocol = getattr(self.protocols, protocol_name) # raises | ||
protocols_to_test.append(protocol) | ||
if override_protocol_names: | ||
for protocol_with_overrides__name in [x.strip() for x in override_protocol_names.split(",")]: | ||
protocol_with_overrides: ProtocolWithOverrides = getattr( | ||
self.protocols_with_overrides, protocol_with_overrides__name | ||
) # raises | ||
if protocol_with_overrides.protocols is not None: | ||
protocols_to_test.extend(protocol_with_overrides.protocols) | ||
if protocols_to_test == []: | ||
return None | ||
return protocols_to_test | ||
|
||
def all_defined_protocols(self) -> list[Protocol]: | ||
return [getattr(self.protocols, prop) for prop in dir(self.protocols) if "__" not in prop] | ||
|
||
def all_defined_protocols_with_overrides(self) -> list[ProtocolWithOverrides]: | ||
return [getattr(self.protocols_with_overrides, prop) for prop in dir(self.protocols_with_overrides) if "__" not in prop] | ||
|
||
|
||
def main() -> None: | ||
console = Console() | ||
protocol_registry = ProtocolRegistry() | ||
console.print("protocols for APP_ANALYSIS_TEST_PROTOCOLS") | ||
console.print(Panel('Formatted for .env APP_ANALYSIS_TEST_PROTOCOLS="')) | ||
sorted_stems = sorted([p.file_stem for p in protocol_registry.all_defined_protocols()]) | ||
console.print('APP_ANALYSIS_TEST_PROTOCOLS="') | ||
console.print(",\n".join(sorted_stems)) | ||
console.print('"') | ||
console.print(Panel('Formatted for .env APP_ANALYSIS_TEST_PROTOCOLS_WITH_OVERRIDES="')) | ||
console.print('APP_ANALYSIS_TEST_PROTOCOLS_WITH_OVERRIDES="') | ||
sorted_stems = sorted([p.file_stem for p in protocol_registry.all_defined_protocols_with_overrides()]) | ||
console.print(",\n".join(sorted_stems)) | ||
console.print('"') | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.