Skip to content

Commit

Permalink
Sync Diagnoses Library (#937)
Browse files Browse the repository at this point in the history
* Update all_the_things for PY3.

PiperOrigin-RevId: 294830845

* Update PhaseDescriptor.with_known_args for PY3

PiperOrigin-RevId: 295795634

* validators: Don't go through the converter when the min/max is not set.

PiperOrigin-RevId: 299141301

* Treat string coordinates as single dimension

PiperOrigin-RevId: 300597711

* openhtf/core/test_descriptor: log and print error stacktrace from output callback funcs.

PiperOrigin-RevId: 300852825

* conf: Always use yaml.safe_load.

PiperOrigin-RevId: 301297425

* Add transforms to measurements.

Add the ability to transform measurement values on setting.  Adding a built-in one for `with_precision` to automatically round floats.

PiperOrigin-RevId: 301469616

* Initial attrs library support.

The attrs library will be used to replace mutablerecords as part of introducing
type annotations.

PiperOrigin-RevId: 302761997

* test_state: Restructure phase context.

Restructure the phase context to remove the hidden context in PhaseState.
Instead, just have the running_phase_context call a finalize function in
PhaseState to handle all the work.

In addition, add the TestState to the PhaseState and remove optional variables.

Lastly, include general readability improvements.

PiperOrigin-RevId: 302824781

* conf_test: Don't modify actual command line for test.

The conf_test wants to run argparse against the command line, but we can use
alternate arguments to not modify the real command line.

PiperOrigin-RevId: 302929683

* Test Executor: Log exceptions tracebacks.

Log exceptions tracebacks for exceptions that occur in the TestExecutor
thread to expose the underlying issues to the user.  These can include
plug issues that are not otherwise surfaced.

PiperOrigin-RevId: 304090542

* util/test: Improve error logging and add test state.

Improve the error logging when tests and phases fail to aid debugging.

Adding a test_state variable to the test case that was just used during yields_phases to increase testability.

Added a unit test that fails if one attempts to use yields_phases/patch_plugs without inheriting from openhtf.util.test.TestCase.

Lastly, fixed lint issues.

PiperOrigin-RevId: 304514879

* diagnoses_lib: Add Measurement and Meta Interpreters

Add higher level signals that can process multiple measurements and phases to
deliver actionable feedback for the manufacturing pipeline.

PiperOrigin-RevId: 305086087

* Add debug logging for the phase outcome.

PiperOrigin-RevId: 305344262

* exe_test: Fix flakiness when thread stopped too soon.

The abort logic fails the thread abort exception occurs while the phase thread
is still starting the abort thread.  Adding an additional event to wait until
ready to trigger the abort.

PiperOrigin-RevId: 305944255

* Diagnoses: Add conditional validators.

Add validators that are only used when a Diagnosis Result has been issued for
the test.

Fix measurements.py lint issues.

Add a test state modification callback to openhtf.util.test.TestCase so tests can add test state or diagnoses prior to yielding phases.

PiperOrigin-RevId: 306357852

* Diagnoses: Add DiagnosesStore to TestDiagnosers.

Add DiagnosesStore as the second parameter to the run functions for
TestDiagnoser.

PiperOrigin-RevId: 306363506

* diagnoses: Add test case for a diagnosis generator that exceptions.

PiperOrigin-RevId: 306964803

* Conditional Validators: as_base_types needs to return a dict, not a set

PiperOrigin-RevId: 307078009

* Diagnoses: Add diagnosers to the test and phase records.

PiperOrigin-RevId: 307487021

* Diagnoses: Make possible_results a property of Diagnosers.

This allows output callbacks to directly use this information.

PiperOrigin-RevId: 307724752

* diagnoses: Add always_fail to diagnosers.

Add an `always_fail` field to diagnosers that cause the diagnoses created by the
diagnoser to always have their `is_failure` field set to True.

PiperOrigin-RevId: 313693148

* diagnoses_lib: Add always_fail to json serialization.

PiperOrigin-RevId: 314197584

* Diagnoses: Make Diagnosis description optional.

Default the the diagnosis descriptions to empty strings to leave setting them up to developers.

Fixed the order of attr.ib calls so that types are first, then defaults, to add clarity.

PiperOrigin-RevId: 316144472
  • Loading branch information
arsharma1 authored Jun 23, 2020
1 parent 4fa142e commit faac61a
Show file tree
Hide file tree
Showing 25 changed files with 2,712 additions and 207 deletions.
17 changes: 11 additions & 6 deletions examples/all_the_things.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,23 @@
python all_the_things.py
"""

import time
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os.path
import time

import openhtf as htf
from openhtf import util
from openhtf.util import units
from openhtf.plugs import user_input
from examples import example_plugs
from openhtf.output import callbacks
from openhtf.output.callbacks import console_summary
from openhtf.output.callbacks import json_factory

from examples import example_plugs
from openhtf.plugs import user_input
from openhtf.util import units
from six.moves import range
from six.moves import zip


@htf.plug(example=example_plugs.ExamplePlug)
Expand Down Expand Up @@ -92,7 +97,7 @@ def set_measurements(test):
def dimensions(test):
for dim in range(5):
test.measurements.dimensions[dim] = 1 << dim
for x, y, z in zip(range(1, 5), range(21, 25), range (101, 105)):
for x, y, z in zip(list(range(1, 5)), list(range(21, 25)), list(range(101, 105))):
test.measurements.lots_of_dims[x, y, z] = x + y + z


Expand Down
8 changes: 8 additions & 0 deletions openhtf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
from openhtf import plugs
from openhtf.core import phase_executor
from openhtf.core import test_record
from openhtf.core.diagnoses_lib import diagnose
from openhtf.core.diagnoses_lib import Diagnosis
from openhtf.core.diagnoses_lib import DiagnosisComponent
from openhtf.core.diagnoses_lib import DiagPriority
from openhtf.core.diagnoses_lib import DiagResultEnum
from openhtf.core.diagnoses_lib import PhaseDiagnoser
from openhtf.core.diagnoses_lib import TestDiagnoser

from openhtf.core.measurements import Dimension
from openhtf.core.measurements import Measurement
from openhtf.core.measurements import measures
Expand Down
Loading

0 comments on commit faac61a

Please sign in to comment.