Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cd3107ba750d
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b117b9320d0d
Choose a head ref
  • 3 commits
  • 12 files changed
  • 1 contributor

Commits on Oct 3, 2015

  1. indent

    sbourdeauducq committed Oct 3, 2015
    Copy the full SHA
    4b2a99b View commit details
  2. Copy the full SHA
    1255031 View commit details
  3. Copy the full SHA
    b117b93 View commit details
10 changes: 5 additions & 5 deletions artiq/frontend/artiq_ctlmgr.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
from artiq.protocols.sync_struct import Subscriber
from artiq.protocols.pc_rpc import AsyncioClient, Server
from artiq.tools import verbosity_args, init_logger
from artiq.tools import TaskObject, asyncio_process_wait_timeout, Condition
from artiq.tools import TaskObject, Condition


logger = logging.getLogger(__name__)
@@ -88,8 +88,8 @@ def _ping(self):
def _wait_and_ping(self):
while True:
try:
yield from asyncio_process_wait_timeout(self.process,
self.ping_timer)
yield from asyncio.wait_for(self.process.wait(),
self.ping_timer)
except asyncio.TimeoutError:
logger.debug("pinging controller %s", self.name)
ok = yield from self._ping()
@@ -137,8 +137,8 @@ def _terminate(self):
"command, killing", self.name)
self.process.kill()
try:
yield from asyncio_process_wait_timeout(self.process,
self.term_timeout)
yield from asyncio.wait_for(self.process.wait(),
self.term_timeout)
except:
logger.warning("Controller %s failed to exit, killing",
self.name)
2 changes: 1 addition & 1 deletion artiq/frontend/artiq_gui.py
Original file line number Diff line number Diff line change
@@ -132,7 +132,7 @@ def main():
args.server, args.port_control, "master_pdb"))
atexit.register(lambda: pdb.close_rpc())
def _get_parameter(k, v):
asyncio.async(pdb.set(k, v))
asyncio.ensure_future(pdb.set(k, v))
d_console = ConsoleDock(
d_params.get_parameter,
_get_parameter,
11 changes: 7 additions & 4 deletions artiq/gui/explorer.py
Original file line number Diff line number Diff line change
@@ -338,7 +338,10 @@ def submit_clicked(self):
arguments = self.argeditor.get_argument_values(True)
if arguments is None:
return
asyncio.async(self.submit(self.pipeline.text(),
expinfo["file"], expinfo["class_name"],
arguments, self.priority.value(),
due_date, self.flush.isChecked()))
asyncio.ensure_future(self.submit(self.pipeline.text(),
expinfo["file"],
expinfo["class_name"],
arguments,
self.priority.value(),
due_date,
self.flush.isChecked()))
2 changes: 1 addition & 1 deletion artiq/gui/schedule.py
Original file line number Diff line number Diff line change
@@ -99,4 +99,4 @@ def delete_clicked(self):
row = idx[0].row()
rid = self.table_model.row_to_key[row]
self.status_bar.showMessage("Deleted RID {}".format(rid))
asyncio.async(self.delete(rid))
asyncio.ensure_future(self.delete(rid))
2 changes: 1 addition & 1 deletion artiq/master/repository.py
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ def scan(self, new_cur_rev=None):
self._scanning = False

def scan_async(self, new_cur_rev=None):
asyncio.async(exc_to_warning(self.scan(new_cur_rev)))
asyncio.ensure_future(exc_to_warning(self.scan(new_cur_rev)))


class FilesystemBackend:
10 changes: 4 additions & 6 deletions artiq/master/worker.py
Original file line number Diff line number Diff line change
@@ -7,8 +7,7 @@
from functools import partial

from artiq.protocols import pyon
from artiq.tools import (asyncio_process_wait_timeout, asyncio_process_wait,
asyncio_wait_or_cancel)
from artiq.tools import asyncio_wait_or_cancel


logger = logging.getLogger(__name__)
@@ -97,15 +96,14 @@ def close(self, term_timeout=1.0):
logger.warning("failed to send terminate command to worker"
" (RID %s), killing", self.rid, exc_info=True)
self.process.kill()
yield from asyncio_process_wait(self.process)
yield from self.process.wait()
return
try:
yield from asyncio_process_wait_timeout(self.process,
term_timeout)
yield from asyncio.wait_for(self.process.wait(), term_timeout)
except asyncio.TimeoutError:
logger.warning("worker did not exit (RID %s), killing", self.rid)
self.process.kill()
yield from asyncio_process_wait(self.process)
yield from self.process.wait()
else:
logger.debug("worker exited gracefully (RID %s)", self.rid)
finally:
4 changes: 2 additions & 2 deletions artiq/test/sync_struct.py
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ def test_recv(self):
self.receiving_done = asyncio.Event()
publisher = asyncio.Future()
test_dict = asyncio.Future()
asyncio.async(start_server(publisher, test_dict))
asyncio.ensure_future(start_server(publisher, test_dict))
loop.run_until_complete(publisher)
loop.run_until_complete(test_dict)

@@ -68,7 +68,7 @@ def test_recv(self):
test_vector = dict()
loop.run_until_complete(write_test_data(test_vector))

asyncio.async(write_test_data(test_dict))
asyncio.ensure_future(write_test_data(test_dict))
self.subscriber = sync_struct.Subscriber("test", self.init_test_dict,
self.notify)
loop.run_until_complete(self.subscriber.connect(test_address,
27 changes: 2 additions & 25 deletions artiq/tools.py
Original file line number Diff line number Diff line change
@@ -88,32 +88,9 @@ def exc_to_warning(coro):
exc_info=True)


@asyncio.coroutine
def asyncio_process_wait_timeout(process, timeout):
# In Python < 3.5, asyncio.wait_for(process.wait(), ...
# causes a futures.InvalidStateError inside asyncio if and when the
# process terminates after the timeout.
# Work around this problem.
@asyncio.coroutine
def process_wait_returncode_timeout():
while True:
if process.returncode is not None:
break
yield from asyncio.sleep(0.1)
yield from asyncio.wait_for(process_wait_returncode_timeout(),
timeout=timeout)

@asyncio.coroutine
def asyncio_process_wait(process):
r = True
while r:
f, p = yield from asyncio.wait([process.stdout.read(1024)])
r = f.pop().result()


@asyncio.coroutine
def asyncio_wait_or_cancel(fs, **kwargs):
fs = [asyncio.async(f) for f in fs]
fs = [asyncio.ensure_future(f) for f in fs]
try:
d, p = yield from asyncio.wait(fs, **kwargs)
except:
@@ -128,7 +105,7 @@ def asyncio_wait_or_cancel(fs, **kwargs):

class TaskObject:
def start(self):
self.task = asyncio.async(self._do())
self.task = asyncio.ensure_future(self._do())

@asyncio.coroutine
def stop(self):
4 changes: 2 additions & 2 deletions conda/artiq/meta.yaml
Original file line number Diff line number Diff line change
@@ -28,14 +28,14 @@ build:

requirements:
build:
- python >=3.4.4
- python >=3.5.0
- setuptools
- numpy
- migen
- pyelftools
- binutils-or1k-linux
run:
- python >=3.4.4
- python >=3.5.0
- llvmlite-artiq
- scipy
- numpy
8 changes: 4 additions & 4 deletions doc/manual/installing.rst
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@ Installing using conda
Installing Anaconda or Miniconda
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* You can either install Anaconda (chose Python 3.4) from https://store.continuum.io/cshop/anaconda/
* You can either install Anaconda (chose Python 3.5) from https://store.continuum.io/cshop/anaconda/

* Or install the more minimalistic Miniconda (chose Python 3.4) from http://conda.pydata.org/miniconda.html
* Or install the more minimalistic Miniconda (chose Python 3.5) from http://conda.pydata.org/miniconda.html

.. warning::
If you are installing on Windows, chose the Windows 32-bit version regardless of whether you have
@@ -148,7 +148,7 @@ These steps are required to generate bitstream (``.bit``) files, build the MiSoC
$ python3 setup.py develop --user

.. note::
The options ``develop`` and ``--user`` are for setup.py to install Migen in ``~/.local/lib/python3.4``.
The options ``develop`` and ``--user`` are for setup.py to install Migen in ``~/.local/lib/python3.5``.

.. _install-xc3sprog:

@@ -369,7 +369,7 @@ This command installs all the required packages: ::

$ sudo apt-get install build-essential autotools-dev file git patch perl xutils-dev python3-pip texinfo flex bison libmpc-dev python3-serial python3-dateutil python3-prettytable python3-setuptools python3-numpy python3-scipy python3-sphinx python3-h5py python3-dev python-dev subversion cmake libusb-dev libftdi-dev pkg-config libffi-dev libgit2-dev

Note that ARTIQ requires Python 3.4.4 or above.
Note that ARTIQ requires Python 3.5.0 or above.

To set user permissions on the JTAG and serial ports of the Pipistrello, create a ``/etc/udev/rules.d/30-usb-papilio.rules`` file containing the following: ::

4 changes: 2 additions & 2 deletions examples/master/repository/speed_benchmark.py
Original file line number Diff line number Diff line change
@@ -71,8 +71,8 @@ class SpeedBenchmark(EnvExperiment):
"""Speed benchmark"""
def build(self):
self.attr_argument("mode", EnumerationValue(["Single experiment",
"With pause",
"With scheduler"]))
"With pause",
"With scheduler"]))
self.attr_argument("payload", EnumerationValue(["NOP",
"CoreNOP",
"CoreSend100Ints",
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
import os


if sys.version_info[:3] < (3, 4, 4):
raise Exception("You need Python 3.4.4+")
if sys.version_info[:3] < (3, 5, 0):
raise Exception("You need Python 3.5.0+")


class PushDocCommand(Command):