Skip to content

Commit 948943c

Browse files
fix page
1 parent 86ebc80 commit 948943c

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

developer-guide/03-Background jobs/02-writing-background-jobs.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,20 +384,21 @@ This class works as is, but we also want to develop a command line interface for
384384
At the bottom of the file, we add:
385385

386386
```python
387+
from pioreactor.cli.run import run
387388
import click
388389

389-
@click.command(name="motor_driver")
390-
@click.option(
390+
@run.command(name="motor_driver")
391+
@run.option(
391392
"--initial-dc",
392393
default=config.getfloat("motor_driver", "initial_duty_cycle"),
393394
show_default=True,
394395
type=click.FloatRange(0, 100, clamp=True),
395396
)
396-
@click.option(
397+
@run.option(
397398
"--hz",
398399
default=config.getfloat("motor_driver", "hz"),
399400
show_default=True,
400-
type=click.FloatRange(1, 10_000, clamp=True),
401+
type=click.FloatRange(1, 50_000, clamp=True),
401402
)
402403
def click_motor_driver(initial_dc, hz):
403404
"""

developer-guide/07-Plugins/01-intro-plugins.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Here's an example: place the following code into the file `/home/pioreactor/.pio
5555
import click
5656
from pioreactor.whoami import get_unit_name, get_assigned_experiment_name
5757
from pioreactor.background_jobs.base import BackgroundJob
58+
from pioreactor.cli.run import run
5859

5960
__plugin_summary__ = "Just a demo job"
6061
__plugin_version__ = "0.0.1"
@@ -77,7 +78,7 @@ class DemoJob(BackgroundJob):
7778
self.logger.debug("Goodbye, world!")
7879

7980

80-
@click.command(name="demo_job", help=__plugin_summary__)
81+
@run.command(name="demo_job", help=__plugin_summary__)
8182
def click_demo_job():
8283

8384
unit = get_unit_name()
@@ -87,12 +88,19 @@ def click_demo_job():
8788
experiment=experiment,
8889
)
8990
job.block_until_disconnected()
91+
9092
```
9193

9294
You should be able to execute the following from the command line now: `pio run demo_job`.
9395

9496
Finally, in your [web interface under plugins](http://pioreactor.local/plugins), you should see "Demo Job" installed.
9597

98+
99+
:::important
100+
Using `run.command` ensures `pio run` can discover your command.
101+
:::
102+
103+
96104
:::info
97105
[A full introduction to writing jobs](/developer-guide/writing-background-jobs) is available.
98106
:::
@@ -112,6 +120,7 @@ from pioreactor.background_jobs.stirring import start_stirring
112120
from pioreactor.background_jobs.od_reading import start_od_reading
113121
from pioreactor.actions.led_intensity import led_intensity
114122
from pioreactor.background_jobs.temperature_automation import start_temperature_automation
123+
from pioreactor.cli.run import run
115124

116125

117126
__plugin_summary__ = "My example script to control stirring, OD and temperature"
@@ -121,7 +130,7 @@ __plugin_author__ = "Cam Davidson-Pilon"
121130
__plugin_homepage__ = "https://docs.pioreactor.com"
122131

123132

124-
@click.command(name="my_script", help=__plugin_summary__) # the name field is used in the invocation `pio run X`
133+
@run.command(name="my_script", help=__plugin_summary__) # the name field is used in the invocation `pio run X`
125134
def click_my_script():
126135

127136
led_intensity({"B": 50})
@@ -135,14 +144,11 @@ def click_my_script():
135144

136145
stirrer.block_until_disconnected()
137146

147+
138148
```
139149

140150
You should be able to execute the following from the command line now: `pio run my_script`. (The `my_script` is from the `@click.command` line, you can change it there).
141151

142-
:::important
143-
The function that `click.command` wraps should have it's name prepended by `click_`. Ex: `def click_my_script` is okay, but `def my_script` is not.
144-
:::
145-
146152
:::info
147153
How do you add this to your /pioreactors page in the UI? See [here](/developer-guide/adding-plugins-to-ui).
148154
:::

user-guide/30-Advanced/02-networking/00-connecting-without-network.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ hide_table_of_contents: true
55
---
66

77

8-
info
9-
:::
108

9+
:::info
1110
This is still a bit experimental and may not work on all systems
12-
1311
:::
1412

1513

@@ -25,7 +23,7 @@ This might work on Windows, too.
2523
5. Open up your terminal, and try the following:
2624

2725
```
28-
ssh pioreactor@your leaders name.local
26+
ssh pioreactor@your_leaders_name.local
2927
```
3028

3129
example:
@@ -41,7 +39,7 @@ This might work on Windows, too.
4139
hostname -I
4240
```
4341

44-
This should provide an IP address. Try that in your browser's URL bar. Example: http://169.254.189.106. Then try: http://your leaders name.local.
42+
This should provide an IP address. Try that in your browser's URL bar. Example: http://169.254.189.106. Then try: http://your_leaders_name.local.
4543

4644

4745
6. You can disconnect your Mac from the Pi's ethernet whenever and things will keep running on it, but note, when you reconnect, it may take a minute again to establish a connection. You should be able then view the UI and also SSH in.

0 commit comments

Comments
 (0)