Skip to content

Commit 5b4e956

Browse files
committed
Great update
1 parent fd0b842 commit 5b4e956

File tree

3 files changed

+176
-57
lines changed

3 files changed

+176
-57
lines changed

main_slack.py

+28-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
slack_token = utils.get_token('res/token_slack.json')
1717
pool = cf.ThreadPoolExecutor(4)
1818

19-
extension_calibration = '_calibration_full.png'
19+
extension_gateerrors = '_gateerrors_full.png'
20+
extension_readouterrors = '_readouterrors_full.png'
2021
extension_jobs = '_jobs_full.png'
2122
extension_full = '_full.png'
2223

@@ -36,9 +37,12 @@ def confirm():
3637
if value.endswith(extension_jobs):
3738
name = 'Pending jobs for {}'.format(backend)
3839
reply = '*Pending jobs* for {} will be sent soon ...'.format(backend)
39-
elif value.endswith(extension_calibration):
40-
name = 'Calibration info for {}'.format(backend)
41-
reply = '*Calibration info* for {} will be sent soon ...'.format(backend)
40+
elif value.endswith(extension_gateerrors):
41+
name = 'Gate errors for {}'.format(backend)
42+
reply = '*Gate errors* for {} will be sent soon ...'.format(backend)
43+
elif value.endswith(extension_readouterrors):
44+
name = 'Readout errors for {}'.format(backend)
45+
reply = '*Readout errors* for {} will be sent soon ...'.format(backend)
4246
elif value.endswith(extension_full):
4347
name = 'Full statistics for {}'.format(backend)
4448
reply = '*Full statistics* for {} will be sent soon ...'.format(backend)
@@ -52,18 +56,33 @@ def confirm():
5256
###
5357
# Bot Commands
5458
###
55-
@app.route('/calibration', methods=['POST'])
56-
def calibration():
59+
@app.route('/gateerrors', methods=['POST'])
60+
def gateerrors():
5761
data = request.form.to_dict()
5862
backend = data['text'].lower()
5963

6064
if backend in utils.backends:
61-
name = 'Calibration info for {}'.format(backend)
62-
pool.submit(send_image, 'tmp/{}{}'.format(backend, extension_calibration),
65+
name = 'Gate errors for {}'.format(backend)
66+
pool.submit(send_image, 'tmp/{}{}'.format(backend, extension_gateerrors),
6367
name, data['channel_id'])
6468
return "Wait a sec ..."
6569
else:
66-
send_buttons(data["response_url"], extension_calibration)
70+
send_buttons(data["response_url"], extension_gateerrors)
71+
return ''
72+
73+
74+
@app.route('/readouterrors', methods=['POST'])
75+
def readouterrors():
76+
data = request.form.to_dict()
77+
backend = data['text'].lower()
78+
79+
if backend in utils.backends:
80+
name = 'Gate errors for {}'.format(backend)
81+
pool.submit(send_image, 'tmp/{}{}'.format(backend, extension_readouterrors),
82+
name, data['channel_id'])
83+
return "Wait a sec ..."
84+
else:
85+
send_buttons(data["response_url"], extension_readouterrors)
6786
return ''
6887

6988

main_telegram.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
info_text = []
1414
info_text.append('You can control me by sending these commands:')
1515
info_text.append('')
16-
info_text.append('/calibration_ibmqx4 - send calibration info')
16+
info_text.append('/gate_errors_ibmqx4 - send gate errorss')
17+
info_text.append('/readout_errors_ibmqx4 - send readout errors')
1718
info_text.append('/jobs_ibmqx4 - diagram of pending jobs')
1819
info_text.append('/full_ibmqx4 - calibration and pending jobs info')
1920
info_text.append('')
20-
info_text.append('/calibration_ibmqx5 - send calibration info')
21+
info_text.append('/gate_errors_ibmqx5 - send gate errors')
22+
info_text.append('/readout_errors_ibmqx5 - send readout errors')
2123
info_text.append('/jobs_ibmqx5 - diagram of pending jobs')
2224
info_text.append('/full_ibmqx5 - calibration and pending jobs info')
2325
info_text = '\n'.join(info_text)
@@ -33,14 +35,18 @@ def choose_backend(bot, update):
3335

3436
command = update.message.text.lower()
3537
path = None
36-
if command == '/calibration_ibmqx4':
37-
path = 'tmp/ibmqx4_calibration_full.png'
38+
if command == '/gate_errors_ibmqx4':
39+
path = 'tmp/ibmqx4_gateerrors_full.png'
40+
elif command == '/readout_errors_ibmqx4':
41+
path = 'tmp/ibmqx4_readouterrors_full.png'
3842
elif command == '/jobs_ibmqx4':
3943
path = 'tmp/ibmqx4_jobs_full.png'
4044
elif command == '/full_ibmqx4':
4145
path = 'tmp/ibmqx4_full.png'
42-
elif command == '/calibration_ibmqx5':
43-
path = 'tmp/ibmqx5_calibration_full.png'
46+
elif command == '/gate_errors_ibmqx5':
47+
path = 'tmp/ibmqx5_gateerrors_full.png'
48+
elif command == '/readout_errors_ibmqx5':
49+
path = 'tmp/ibmqx5_readouterrors_full.png'
4450
elif command == '/jobs_ibmqx5':
4551
path = 'tmp/ibmqx5_jobs_full.png'
4652
elif command == '/full_ibmqx5':

0 commit comments

Comments
 (0)