Skip to content

Commit

Permalink
Simple workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros11 committed Oct 5, 2023
1 parent dbf5567 commit 6a905eb
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 36 deletions.
41 changes: 5 additions & 36 deletions .github/workflows/selfhosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,15 @@ jobs:
tests:
strategy:
matrix:
platform: ["qw5q_gold_qblox"]
platform: ["dummy"]
fail-fast: false
runs-on: self-hosted
steps:
- name: Cleanup workspace manually
run: |
rm -rf _work/*
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install and configure poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-pip-wheels
uses: actions/cache@v3
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install qibolab
- name: Execute on ${{ matrix.platform }} queue
run: |
python -m venv testenv
source testenv/bin/activate
python -m pip install --upgrade pip
python -m pip install qibolab[qblox]
#- name: Load queues json to variable
# id: setqueues
# run: |
# content=`cat ./queues.json`
# echo "::set-output name=queues::$content"
#- run: |
# echo "${{fromJson(steps.setqueues.outputs.queues).version}}"
#- name: Execute on ${{ matrix.platform }} queue
# run: |
# sed -i 's/$PLATFORM/'${{ matrix.platform }}'/' selfhosted
# srun -p ${{ matrix.platform }} selfhosted
# mkdir coverage
# mv coverage.xml coverage/
# mv htmlcov coverage/
module load qibo
PARTITION="$(python queues.py qw5q_gold_qblox)"
srun -p $PARTITION python tests/minimal.py ${{ matrix.platform }}
15 changes: 15 additions & 0 deletions queues.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pathlib import Path

import click
import yaml


@click.command()
@click.argument("name", type=str)
def main(name):
data = yaml.safe_load(Path("queues.yml").read_text())
print(data[name])


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions queues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dummy: qw5q_gold
33 changes: 33 additions & 0 deletions tests/minimal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import click
from qibolab import ExecutionParameters, create_platform
from qibolab.pulses import PulseSequence


@click.command()
@click.argument("name", type=str)
def main(name):
platform = create_platform(name)

sequence = PulseSequence()
for q in platform.qubits:
qd_pulse = platform.create_RX_pulse(q)
ro_pulse = platform.create_MZ_pulse(q, start=qd_pulse.duration)
sequence.add(qd_pulse)
sequence.add(ro_pulse)

platform.connect()
platform.setup()
platform.start()

options = ExecutionParameters(nshots=1000)
results = platform.execute_pulse_sequence(sequence, options=options)

platform.stop()
platform.disconnect()

for q in platform.qubits:
print(results[q])


if __name__ == "__main__":
main()

0 comments on commit 6a905eb

Please sign in to comment.