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

Resin for app-3-0 (Chore) #347

Merged
merged 26 commits into from
Oct 6, 2017
Merged

Resin for app-3-0 (Chore) #347

merged 26 commits into from
Oct 6, 2017

Conversation

jarmg
Copy link
Contributor

@jarmg jarmg commented Sep 24, 2017

overview

This PR brings resin into app-3-0 which will successfully build a docker image running the server for the api.

We still need to decide how we want to partition devices/applications, but this is something that we'll need to discuss.

This PR includes:

  • Chore work
  • Bug fixes
  • Backwards-compatible feature additions
  • Breaking changes
  • Documentation updates
  • Test updates

Note: If you did not check "Documentation updates" and/or "Test updates" then your PR may not be ready!

changelog

Write descriptions for your changes. If a change is related to a GitHub issue, please tag the issue in the description.

  • (Chore) This bring resin into app-3-0
  • (Fix) Change description
  • (Feature) Change description
  • (Refactor) Change description
  • (Docs) Change description
  • (Tests) Change description

Note: If your PR incorporates many changes, or many different types of changes, please consider splitting it up into smaller PRs.

review requests

Describe any specific requests for your reviewers here. Tag any people or groups as necessary.

@codecov
Copy link

codecov bot commented Sep 24, 2017

Codecov Report

Merging #347 into app-3-0 will increase coverage by 1.73%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           app-3-0     #347      +/-   ##
===========================================
+ Coverage    82.98%   84.72%   +1.73%     
===========================================
  Files           73       80       +7     
  Lines         4737     6480    +1743     
===========================================
+ Hits          3931     5490    +1559     
- Misses         806      990     +184
Impacted Files Coverage Δ
app/rpc/websocket-client.js 90% <0%> (-4.12%) ⬇️
app/ui/robot/api-client/client.js 30% <0%> (-2.97%) ⬇️
api/opentrons/robot/robot.py 91.97% <0%> (-0.15%) ⬇️
app/ui/containers/Root.js 0% <0%> (ø) ⬆️
app/ui/containers/Nav.js 0% <0%> (ø) ⬆️
api/opentrons/session/__init__.py 100% <0%> (ø) ⬆️
app/ui/components/RunNotifications.js 0% <0%> (ø) ⬆️
app/shell/preferences.js 0% <0%> (ø) ⬆️
app/ui/components/RunLog.js 0% <0%> (ø) ⬆️
app/ui/components/NavPanel.js 0% <0%> (ø) ⬆️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7419532...c7adc9a. Read the comment docs.

@jarmg jarmg requested review from astaff and mcous September 24, 2017 22:05
@@ -1,4 +1,5 @@
pylama
pyserial==3.2.1
Copy link
Contributor

Choose a reason for hiding this comment

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

So I think we need to align as a team on where dev dependencies go and where prod dependencies go. I'm fine with prod dependencies living here, but I've heard stuff about why pyserial isn't in requirements.txt so I'd like to understand what we're doing

Copy link
Contributor

Choose a reason for hiding this comment

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

@mcous see my comment in Dockerfile above

Copy link
Contributor

Choose a reason for hiding this comment

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

RUN apt-get update
RUN apt-get install gcc make git g++

RUN pip install -r ./requirements.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

opentrons is a python package, we should install it using setup.py through pip install

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there a way to install the app-3-0 branch using pip?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, pip install <path-to-setup.py> ... Can be pip install api/ or pip install . depending on where you are.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great but out of scope for alpha


COPY ./api/requirements.txt ./requirements.txt
RUN apt-get update
RUN apt-get install gcc make git g++
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. because we are using out requirements.txt for installing (though this could change pending other review comments)
  2. Because we need apt-get to be updated so it can find gcc
  3. Because we need gcc, make, git, and g++

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha. Do you think we can pre-build packages requiring native compilation to reduce image size?
We might want to run apt-get series in a single RUN command: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great but out of scope for alpha

@@ -1,4 +1,5 @@
pylama
pyserial==3.2.1
Copy link
Contributor

Choose a reason for hiding this comment

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

@mcous see my comment in Dockerfile above

cd /usr/src/api

echo "[BOOT] Starting server"
python /usr/src/api/opentrons/server/main.py '0.0.0.0':8080
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to move from our 31950 default port?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, I'll change it back

import time

import serial

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks specific to our testing environment. Do we need this file here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for andy to be able to test on ot-2

@mcous mcous mentioned this pull request Oct 2, 2017
2 tasks
Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

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

Dockerfile seems a little redundant, and I'm also concerned about the dev dependencies in a production container (as noted by @astaff). Will slow down our deploys. Fine to merge, though, but would appreciate some TODOs


RUN pip install -r ./requirements.txt

COPY ./api ./api
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the two copy calls? I would think it would work if we did

COPY ./api ./api
# ...
RUN pip install -r ./api/requirements.txt
# ...

@jarmg jarmg changed the base branch from app-3-0 to app-3-0-alpha-demo October 6, 2017 00:57
@jarmg jarmg merged commit f55ebd8 into app-3-0-alpha-demo Oct 6, 2017
jarmg pushed a commit that referenced this pull request Oct 6, 2017
* atempting image build

* attempting image build

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* adding motion testing_script

* resin image build

* resin image build

* resin image build

* resin image build

* resin README added

* slight refactor for PR

* docs adjustment

* docs adjustment

* moved filed

* linting fix

* Change server port and fix life-testing script

* add TODOs to Dockerfile.template
@astaff astaff deleted the v3-feat-resin branch October 11, 2017 22:30
astaff added a commit that referenced this pull request Oct 24, 2017
* driver started

* Implements working pipette probing

Create a script that serves as a functional version of pipette probing
which still needs to be logically placed into correct location in code base.
Begin implementation of Gantry and Base classes.

* Expand on Probe and Base classes

* enable OTtwo to run existing protocols

* set the slot and mount offsets

* Enable probing with both pipettes

Adjust offsets and probe position / dimensions to enable
probing for both pipettes. Also adds mounts to pipettes (this is a hack)
to enable offset values to be pulled from instruments so they can be used
in calibration. This update of the global dicts should also allow calibration
to persist between probing and running.

* corrects deck offset

* driver started

* Implements working pipette probing

Create a script that serves as a functional version of pipette probing
which still needs to be logically placed into correct location in code base.
Begin implementation of Gantry and Base classes.

* Expand on Probe and Base classes

* enable OTtwo to run existing protocols

* set the slot and mount offsets

* Enable probing with both pipettes

Adjust offsets and probe position / dimensions to enable
probing for both pipettes. Also adds mounts to pipettes (this is a hack)
to enable offset values to be pulled from instruments so they can be used
in calibration. This update of the global dicts should also allow calibration
to persist between probing and running.

* corrects deck offset

* driver and api integration work for the demo

* added axis to models.Instrument

* add jog functionality

* change jog function name

* remove robot from session, make it home before run

* use reset() instead of hard reset in robot test fixture

* Use driver.(dis)connect instead of toggling simulating flag directly

* Resin for app-3-0 (Chore) (#347)

* attempting image build

* attempting image build

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* adding motion testing_script

* resin image build

* resin image build

* resin image build

* resin image build

* resin README added

* slight refactor for PR

* docs adjustment

* docs adjustment

* moved filed

* linting fix

* Change server port and fix life-testing script

* add TODOs to Dockerfile.template

* Resin for app-3-0 (Chore) (#347)

* atempting image build

* attempting image build

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* adding motion testing_script

* resin image build

* resin image build

* resin image build

* resin image build

* resin README added

* slight refactor for PR

* docs adjustment

* docs adjustment

* moved filed

* linting fix

* Change server port and fix life-testing script

* add TODOs to Dockerfile.template

* make ot_data live on USB on pi

* flip well positions for database migration

* Functional tests for API

- Added position tracking and position log for driver when running in
  simulate mode for testing purposes
- Re-wired calibration_manager.jog to call
  calibration_functions.jog_instrument properly
- Added API functional tests in api/test_functional.py consistent with
  common use cases.
- Added bradford assay edited to fit OT-2 deck

* rotate containers for ot-alpha and fix well offsets

* Make moving more consistent and tidy things up

Make instrument movement more consistent by using it's mover
instead of the driver. Also remove a few print statements and an
unused functionality in the driver.

* prevent homing of nonexistent pip

* fix tests

* modify target values for homing

* Add methods for updating z lenth of pipette in pose tracker instead of adding on the fly

* use correct variable in direct movement strategy

* adjust pipette position with tip offset

* fix ui calibration setting and track relative position

* Fixes for relative path access in posetracker, add all files starting with . to gitignore

* fix logical errors in relative position access

* adjust offsets for avagadro and toss probing deltas

* adjust offsets in prep for KV demo

* fix height of non-moving pipette during move

* functioning calibration cli

* output cleanup

* move pipette by applying transformation from deck branch of a posetracker bypassing instrument branch of pose-tracker, adjust container definitions based on real life tests, add smoke test to api/test_integration, change tip pickup move sequence and travel, change tip offset to be applied to move command instead of being tracked in posetracker

* functioning calibration cli

* output cleanup

* move pipette by applying transformation from deck branch of a posetracker bypassing instrument branch of pose-tracker, adjust container definitions based on real life tests, add smoke test to api/test_integration, change tip pickup move sequence and travel, change tip offset to be applied to move command instead of being tracked in posetracker

* refactorings after review with Ben

* integrate factory calibration with pose tracker, make changes in pose tracker to account for transformation alongside with translation, fix tests

* 1) Improved smoothie driver to not send duplicate commands if we are
already at the point for an axis
2) caching position so we don’t have to make serial calls every time we
need position, reduces the risk of error in serial comms which are shaky
3) Fix a bug that was introduced after we made `position` a tuple, after
which `+` operator did concatenation, not a vector sum
4) Improved `api/test_integration` to aggregate move logs by axis for
easier analysis
5) Added test to confirm trashbox is present in session containers when
drop_tip is called with no arguments in the protocol (cc @mike @jared)
6) Fixed api tests WRT to connect attempts being made to actual device -

* Add back in assert statement for test

* making smoke test work, refactoring calibration tests, refactoring tip probe

* fixes
astaff added a commit that referenced this pull request Oct 24, 2017
* Add react-router (with redux bindings) to UI

* Reorganize container structure with routes

- Removes Root container in favor of more specific containers
- Adds ConnectedRunControls container for run controls
- Adds some basic routing to App.js (which is now top-level comp)

* implement run button in run button header, style updates

* Scaffold out routes for pipette and deck setup

* clean up run controls layout

* cleanup sidebar layout, fix run log scroll

* minor style fiddling

* fix linting errors

* Dispatch a successful connect response if already connected

* initial pipetteConfig component and styles

* static single pipette config component

* API work to enable calibration experience (#352)

* Implement `get_contaieners` and `get_instruments` and underlying code to accumulate and interpret command messages.

* Introduce `MainRouter` as a root client API object and make it contain `calibration_manager` and `session_manager`.

* Remove notification handling from `SessionManager` and `Session` and move it up to `MainRouter`, clean up tests.

* Add model data classes for labware and instruments to limit scope of client API surface.

* Add `location` to commands where appropriate and change `publish` to translate `self` to `location` if needed.

* Consolidate Client API related code under `opentrons.api`.

* wire up mock props pipette config container

* fix linting errors

* render pipettes toggle active pipette route in pipette config

* added tip probe messages as bottom panel

* shrink sidebar slightly, default tip probe state

* Fix API make install task and update client remote for MainRouter

* Fix resume and reconnect (#346)

* start task instead of await in websocket message handler loop to allow concurrent calls; add test for concurrent calls

* add test stub for concurrent connections

* fix crashes on disconnect, add tests for concurrent connections and disconnect

* send messages to different clients independently, test for simultaneous connects and disconnects

* refactor how send queues and tasks are being managed, improve tests

* Add run timer cleanup to client disconnect

* change levels for logging messages, change logging level in main.py handler, remove task from the queue once done

* make robot.smoothie_driver private

* move init of seen to top, to have it initiaized before we try to create remote objects in parallel for array

* Resolve array remotes serially to avoid type resolution race

* Calibration API Implementation (#366)

* add calibration API tests, make _simulate call exec instead of relying on run with no arguments

* add test for serializing class object attributes

* Harmonize shape of notifications, reduce state tree

* Make notification payload to be a copy of self across the board
* Remove Wells from Container data object to reduce Session state tree

* Refactor `placeable.get_container`

* Don't treat `WellSeries` as container
* Make `placeable.get_trace()` a generator
* Add functional test with full protocol to test session model

* V3a calibration nav panel (#363)

* separate container for SetupPanel
* list pipette links with optional axis params, list labware with optional params - only show once pipettes are probed
* setup panel layout updates, conditionally render labware links and run link
* layout cleanup
* conditionally disable non tipracks until tipracks have been confirmed
* add proptypes
* map -> reduce
* fix proptype
* always render laware list, disable until intruments are calibrated

* (v3 alpha, feature) Calibration API client state (#368)

* Add instrument and labware state translation to API client

* Add private ID field to RemoteObjects

* Add actions for CalibrationManager calls and responses

* Wire calibration actions and responses to API client

* Track calibration API request state in redux store

* V3a ui calibrate labware (#369)

* separate container for SetupPanel
* list pipette links with optional axis params, list labware with optional params - only show once pipettes are probed
* initial deckmap for rework
* confirm deck layout, styles
* separate deckmap function
* initial jod modal nested route, container, component. Remove position, replace with numerical slots, add ids for legacy slot names
* convert labware wrapper elements to links, add active container/link styling
* jog modal container, component, styling, and placeholder cotent and route
* cleanup labware labels
* jog modal button placeholder, general cleanup
* render default pipette imgs, reset mock state after demo, sync tip prob and labware calibration notifications to state

* (v3 alpha) Calibration UI MVP (#372)

* static jog buttons for wriring

* minor ui style updates, nav icons now router links, splash screen for upload page

* render placeholder images for bradford assay labware

* remove navlinks from sidebar, labware, pipettes in favor of current instrument and current labware

* Wire up instrument calibration and some of labware confirmation

* Wire some labware selectors to SetupPanel and DeckConfig

* Wire labware review state+button, simplify bool prop names

* update setup panel styles, default splash screen and route

* nest tip probe notifications within pipette config

* fix lint, troubleshoot Prepare for tip probe props

* Wire up labware confirmation for all Yes clicks (no jog)

* Wire up jog modal and confirmation button / reducers

* labware selected, disabled, active, confirmed styles

* Fix API calls for calibration and run (and unit tests)

* Fix lint errors in Labware.js and .css

* Driver, Pose Tracker and Calibration procedure (#374)

* driver started

* Implements working pipette probing

Create a script that serves as a functional version of pipette probing
which still needs to be logically placed into correct location in code base.
Begin implementation of Gantry and Base classes.

* Expand on Probe and Base classes

* enable OTtwo to run existing protocols

* set the slot and mount offsets

* Enable probing with both pipettes

Adjust offsets and probe position / dimensions to enable
probing for both pipettes. Also adds mounts to pipettes (this is a hack)
to enable offset values to be pulled from instruments so they can be used
in calibration. This update of the global dicts should also allow calibration
to persist between probing and running.

* corrects deck offset

* driver started

* Implements working pipette probing

Create a script that serves as a functional version of pipette probing
which still needs to be logically placed into correct location in code base.
Begin implementation of Gantry and Base classes.

* Expand on Probe and Base classes

* enable OTtwo to run existing protocols

* set the slot and mount offsets

* Enable probing with both pipettes

Adjust offsets and probe position / dimensions to enable
probing for both pipettes. Also adds mounts to pipettes (this is a hack)
to enable offset values to be pulled from instruments so they can be used
in calibration. This update of the global dicts should also allow calibration
to persist between probing and running.

* corrects deck offset

* driver and api integration work for the demo

* added axis to models.Instrument

* add jog functionality

* change jog function name

* remove robot from session, make it home before run

* use reset() instead of hard reset in robot test fixture

* Use driver.(dis)connect instead of toggling simulating flag directly

* Resin for app-3-0 (Chore) (#347)

* attempting image build

* attempting image build

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* adding motion testing_script

* resin image build

* resin image build

* resin image build

* resin image build

* resin README added

* slight refactor for PR

* docs adjustment

* docs adjustment

* moved filed

* linting fix

* Change server port and fix life-testing script

* add TODOs to Dockerfile.template

* Resin for app-3-0 (Chore) (#347)

* atempting image build

* attempting image build

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* fixing Dockerfile.template

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* refactor server start

* adding motion testing_script

* resin image build

* resin image build

* resin image build

* resin image build

* resin README added

* slight refactor for PR

* docs adjustment

* docs adjustment

* moved filed

* linting fix

* Change server port and fix life-testing script

* add TODOs to Dockerfile.template

* make ot_data live on USB on pi

* flip well positions for database migration

* Functional tests for API

- Added position tracking and position log for driver when running in
  simulate mode for testing purposes
- Re-wired calibration_manager.jog to call
  calibration_functions.jog_instrument properly
- Added API functional tests in api/test_functional.py consistent with
  common use cases.
- Added bradford assay edited to fit OT-2 deck

* rotate containers for ot-alpha and fix well offsets

* Make moving more consistent and tidy things up

Make instrument movement more consistent by using it's mover
instead of the driver. Also remove a few print statements and an
unused functionality in the driver.

* prevent homing of nonexistent pip

* fix tests

* modify target values for homing

* Add methods for updating z lenth of pipette in pose tracker instead of adding on the fly

* use correct variable in direct movement strategy

* adjust pipette position with tip offset

* fix ui calibration setting and track relative position

* Fixes for relative path access in posetracker, add all files starting with . to gitignore

* fix logical errors in relative position access

* adjust offsets for avagadro and toss probing deltas

* adjust offsets in prep for KV demo

* fix height of non-moving pipette during move

* functioning calibration cli

* output cleanup

* move pipette by applying transformation from deck branch of a posetracker bypassing instrument branch of pose-tracker, adjust container definitions based on real life tests, add smoke test to api/test_integration, change tip pickup move sequence and travel, change tip offset to be applied to move command instead of being tracked in posetracker

* functioning calibration cli

* output cleanup

* move pipette by applying transformation from deck branch of a posetracker bypassing instrument branch of pose-tracker, adjust container definitions based on real life tests, add smoke test to api/test_integration, change tip pickup move sequence and travel, change tip offset to be applied to move command instead of being tracked in posetracker

* refactorings after review with Ben

* integrate factory calibration with pose tracker, make changes in pose tracker to account for transformation alongside with translation, fix tests

* 1) Improved smoothie driver to not send duplicate commands if we are
already at the point for an axis
2) caching position so we don’t have to make serial calls every time we
need position, reduces the risk of error in serial comms which are shaky
3) Fix a bug that was introduced after we made `position` a tuple, after
which `+` operator did concatenation, not a vector sum
4) Improved `api/test_integration` to aggregate move logs by axis for
easier analysis
5) Added test to confirm trashbox is present in session containers when
drop_tip is called with no arguments in the protocol (cc @mike @jared)
6) Fixed api tests WRT to connect attempts being made to actual device -

* Add back in assert statement for test

* making smoke test work, refactoring calibration tests, refactoring tip probe

* fixes
@astaff astaff mentioned this pull request Nov 13, 2017
6 tasks
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.

3 participants