m-labs / artiq

A leading-edge control system for quantum information experiments
https://m-labs.hk/artiq
GNU Lesser General Public License v3.0
434 stars 201 forks source link

Request: --version command-line arg for bug reporting #1160

Closed drewrisinger closed 5 years ago

drewrisinger commented 6 years ago

When bug reporting, it's useful to have an idea what ARTIQ version is causing the issue. I suggest adding a --version flag to artiq_run or artiq_master to print the version number.

It could be added elsewhere, but this seems one of the easiest places.

Implementation (neglecting adding flag to argparse):

import artiq

print("Current ARTIQ version: {}".format(artiq.__version__))
sbourdeauducq commented 6 years ago

That can be obtained with conda list or running that code in the python repl. The issue is to which tool the flag should be added. Why not dashboard, browser, or compile?

jordens commented 6 years ago

artiq_run and _master are fine by me. Why not just add it to verbosity_args()? That covers a lot.

sbourdeauducq commented 6 years ago

Maybe rename verbosity_args to e.g. common_args then?

drewrisinger commented 6 years ago

@sbourdeauducq That would require a fair amount of refactoring, though I agree with the idea. A quick scan of the repo shows ~15 files where verbosity_args is used, not counting code built on top of it.

drewrisinger commented 6 years ago

Also, processing the --version flag could be abstracted to some common function, maybe something like (in artiq.tools):

def process_common_args(cmd_arguments: argparse.Namespace):
    """Process common ARTIQ arguments."""
    if cmd_arguments.version:
        # print version
    init_logger(cmd_arguments)

Edit: removed bind processing b/c needs special return, doesn't process in place

drewrisinger commented 6 years ago

See #1181 for related PR.

drewrisinger commented 5 years ago

Pending approval on #1181