-
Notifications
You must be signed in to change notification settings - Fork 23
/
README
218 lines (146 loc) · 6.88 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
===========================================================
Ocean Observatories Initiative Cyberinfrastructure (OOI CI)
Integrated Observatory Network (ION) - OOINet
pyon - Python Capability Container and Core Modules
https://confluence.oceanobservatories.org/x/ehdTAQ
(C) The Regents of the University of California, 2010-2014
Open source under BSD license. See LICENSE.txt for details.
===========================================================
INSTALL
=======
Install the following if not yet present:
* OS Packages and package management:
For Mac, use homebrew
> /usr/bin/ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
- python 2.7.x
> brew install python --framework --universal
Note: see 'brew doctor' for any path issues
- git 1.7.7 or higher: Use brew or download the Mac or Linux installer and run it
> brew install git
- Install core packages with Homebrew
> brew install libevent libyaml zeromq rabbitmq hdf5 pkg-config netcdf udunits
Linux: Note that many installs have much older versions installed by default.
(If you have trouble with brew 'MD5 mismatch' errors, try running 'brew update'
and try the install again)
For any kind of installation trouble run 'brew doctor' and fix any issues.
- Install Postgres with Homebrew
> brew install postgres postgis
If you have trouble with the installation, please see:
https://confluence.oceanobservatories.org/display/CIDev/Postgres+Datastore
https://confluence.oceanobservatories.org/display/CIDev/M112+Geospatial+Search
As user postgres:
> createuser -s ion
* Python packages and environment management:
- pip
> easy_install pip
- virtualenv and virtualenvwrapper modules for your python 2.7 installation
> easy_install --upgrade virtualenv
> easy_install --upgrade virtualenvwrapper
Note: This require Mac's XCode with installed command line tools
* Setup a virtualenv to use for Pyon:
> mkvirtualenv --no-site-packages pyon
* Pin setuptools in your virtualenv
> pip install -U setuptools==0.8
* Install numpy to the virtualenv
> pip install numpy==1.7.1
DEVELOPMENT TIME DEPENDENCIES
=============================
PACKAGES:
Use Buildout to install the python package dependencies with:
> python bootstrap.py -v 2.2.0
> bin/buildout
** Add following to your .bashrc profile on Macs if buildout fails to
compile for packages such as gevent, pyml, etc.
export C_INCLUDE_PATH=/usr/local/include
ION-DEFINITIONS SUBMODULE:
Link git submodule ion-definitions, containing object and service definitions and resource files:
git submodule update --init
Note: This git-submodule always references a specific commit of ion-definitions used by pyon.
Hint: The .gitmodules file declares the submodule as read only GIT reference (https: instead of git@).
If you have problems with a read only (anonymous) clone because of a missing public key,
edit .git/config and change the last url to git://github.com/ooici/ion-definitions.git
If you want to avoid entering your password for every push to the submodule,
edit extern/ion-definitions/.git/config and change the remote reference to:
[email protected]:ooici/ion-definitions.git
To update the code in pyon and the specific commit in the submodule:
> git pull
> git submodule update
Notes:
- The submodule update does NOT happen automatically
- The submodule update does NOT pull the branch head of the submodule.
- To change the submodule commit within pyon, cd into the submodule and do a `git pull`, then commit pyon.
The obj/ subdir is a symlink to the checkout's extern/ion-definitions/objects.
The res/ subdir is a symlink to the checkout's extern/ion-definitions/res.
See more about submodules:
- http://book.git-scm.com/5_submodules.html
- http://speirs.org/blog/2009/5/11/understanding-git-submodules.html
- http://blog.endpoint.com/2010/04/git-submodule-workflow.html
GENERATE SERVICE STUBS:
Generate service definition interfaces and abstract base classes files:
> bin/generate_interfaces
Note: These will be placed in the interfaces/ subdirectory (and not in GIT nor in the egg).
RUN-TIME DEPENDENCIES
=====================
POSTGRESQL (DATABASE):
Run postgresql in second terminal before starting the container or running tests:
> /usr/local/bin/postgres -D /usr/local/var/postgres
RABBITMQ (MESSAGE BROKER):
> rabbitmq-server
SOURCE PATH:
Add the current directory to your PYTHONPATH for an easier time running
scripts. Add the following line to your ~/.profile (create it if it
doesn't exist, or use bash_profile if you already have that):
export PYTHONPATH=.
TEST
====
Run the unittests:
bin/nosetests -a UNIT
Run code coverage:
bin/nosetests -w pyon --with-coverage --cover-package=pyon
USE
===
Provide local configuration overrides in:
res/config/pyon.local.yml
res/config/logging.local.yml
Start the capability container in interactive mode:
> bin/pycc
List supported arguments:
> bin/pycc --help
Start the CC with a deploy file:
> bin/pycc --rel res/deploy/r2deploy.yml
Start the CC with a process to execute and then quit:
> bin/pycc --proc examples.service.hello_service.HelloService
Command line configuration options for pycc:
Use a different message broker:
> bin/pycc server.amqp.host=amoeba.ucsd.edu
Use a different database server:
> bin/pycc server.couchdb.host=amoeba.ucsd.edu
Set the container's system name:
> bin/pycc system.name=MINE
DEBUG
=====
USE Pycharm or any other Python IDE to debug; breakpoints and step-by-step are possible.
Set the executable to the bin/pycc and set the working directory to the repository root.
Use the -n option to avoid the interactive ipython shell. It does not work property with the debugger.
You will need to make sure the Pycharm debug egg is available in your path, something like:
> export PYTHONPATH=.:/Applications/PyCharm\ 1.5.2.app/pycharm-debug.egg
Remote debugging of services in a running container is possible too. Setup a remote debugging
configuration to use the localhost and port 8585. First start the remote debuging server, then
start the container from the command line below (the -n seems to be required)
> bin/pyccd -n --rel res/deploy/r2services.yml
DATASTORE
=========
Use psql
EXAMPLES
========
Make sure to look in the examples directory for a README and examples.
SEE ALSO
========
https://confluence.oceanobservatories.org/display/CIDev/ION+R2+Development
https://confluence.oceanobservatories.org/display/CIDev/R2+Container+Use+Guide
https://confluence.oceanobservatories.org/display/CIDev/R2+Development+Conventions
https://confluence.oceanobservatories.org/display/CIDev/R2+Resource+Development+Guide
https://confluence.oceanobservatories.org/display/CIDev/R2+Service+Implementation+Guide
https://confluence.oceanobservatories.org/display/CIDev/R2+Service+Testing+Guide
https://confluence.oceanobservatories.org/x/ehdTAQ
https://github.com/ooici/coi-services