-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add log_tuples function #1896
add log_tuples function #1896
Conversation
artiq/master/worker_impl.py
Outdated
@@ -342,7 +347,7 @@ def write_results(): | |||
try: | |||
exp_inst.analyze() | |||
put_completed() | |||
finally: | |||
finally: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clean up
artiq/master/worker_impl.py
Outdated
@@ -286,6 +286,10 @@ def write_results(): | |||
f["run_time"] = run_time | |||
f["expid"] = pyon.encode(expid) | |||
|
|||
def log_tuples(): | |||
with open("tuples.txt", "a") as f: | |||
f.write("%s %s %s\n" %(rid, start_time, expid["file"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use new style format "".format()"
"tuples" is too generic of a name. https://en.wikipedia.org/wiki/Tuple |
What happens if multiple experiments are executed at the same time? This can happen if they are scheduled in different pipelines. Can't that corrupt the file? |
artiq/master/worker_impl.py
Outdated
@@ -286,6 +286,10 @@ def write_results(): | |||
f["run_time"] = run_time | |||
f["expid"] = pyon.encode(expid) | |||
|
|||
def log_tuples(): | |||
with open("tuples.txt", "a") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*Chang the file name * Write to the file from the scheduler
artiq/master/scheduler.py
Outdated
@@ -122,6 +122,13 @@ def __init__(self, ridc, worker_handlers, notifier, experiment_db): | |||
self.notifier = notifier | |||
self.experiment_db = experiment_db | |||
|
|||
def log_tuples(self, rid, expid): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Tuples" is not a good name in functions either. What about log_submissions
?
artiq/master/scheduler.py
Outdated
self.rid = rid | ||
self.expid = expid | ||
start_time = time() | ||
with open("rid_time_path.txt", "a") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
experiment_submissions.log
as a default file name would be better. And make that logging optional and the file name configurable via the command line arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even .csv
with ,
as separator?
* make the file name configurable
artiq/frontend/artiq_master.py
Outdated
@@ -53,7 +53,10 @@ def get_argparser(): | |||
"--experiment-subdir", default="", | |||
help=("path to the experiment folder from the repository root " | |||
"(default: '%(default)s')")) | |||
|
|||
group.add_argument( | |||
"--log-filename", default="experiment_submissions.csv", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep disabled by default
artiq/frontend/artiq_master.py
Outdated
@@ -53,7 +53,10 @@ def get_argparser(): | |||
"--experiment-subdir", default="", | |||
help=("path to the experiment folder from the repository root " | |||
"(default: '%(default)s')")) | |||
|
|||
group.add_argument( | |||
"--log-filename", default="experiment_submissions.csv", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep disabled by default
artiq/frontend/artiq_master.py
Outdated
help=("set the filename of the experiment subimission " | ||
"(default: '%(default)s')")) | ||
"--log-filename", default=None, | ||
help=("(optional) set the filename to create the experiment subimission ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grammar, typo, space at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I don't think we want this in the "repository" options group. Suggest putting it at the top level like --name
artiq/master/scheduler.py
Outdated
self.rid = rid | ||
self.expid = expid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why write to self
?
artiq/master/scheduler.py
Outdated
self.rid = rid | ||
self.expid = expid | ||
start_time = time() | ||
if self.log_filename != None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is not None
artiq/master/scheduler.py
Outdated
@@ -135,6 +146,7 @@ def submit(self, expid, priority, due_date, flush, pipeline_name): | |||
wd, repo_msg = None, None | |||
run = Run(rid, pipeline_name, wd, expid, priority, due_date, flush, | |||
self, repo_msg=repo_msg) | |||
self.log_submissions(rid, expid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log_submission
, singular
artiq/test/test_scheduler.py
Outdated
@@ -90,7 +90,7 @@ def setUp(self): | |||
|
|||
def test_steps(self): | |||
loop = self.loop | |||
scheduler = Scheduler(_RIDCounter(0), dict(), None) | |||
scheduler = Scheduler(_RIDCounter(0), dict(), None, "experiment_submissions.csv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're not reading the file in the test, then don't write it and set it to None
. You could just use None
as default value in the Scheduler
's parameter, then it's backward-compatible and you don't need to edit the test and potentially other code.
artiq/frontend/artiq_master.py
Outdated
@@ -53,7 +53,9 @@ def get_argparser(): | |||
"--experiment-subdir", default="", | |||
help=("path to the experiment folder from the repository root " | |||
"(default: '%(default)s')")) | |||
|
|||
group.add_argument( | |||
"--log-filename", default=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are already other "logging" options in the master and this is confusing. --log-submissions
?
*Remove the typos and 'self' *Rename the function and argument *Set the variable to None in test file
Oops, should have renamed the commit |
ARTIQ Pull Request
Description of Changes
add log_tuples function which can write the runid, start_time and path to a file in the data directory
Related Issue
Log runid/start_time/path tuples to a file in the data directory #810
Type of Changes
Steps (Choose relevant, delete irrelevant before submitting)
All Pull Requests
git commit --signoff
, see copyright).Code Changes
Git Logistics
git rebase --interactive
). Merge/squash/fixup commits that just fix or amend previous commits. Remove unintended changes & cleanup. See tutorial.git show
). Format:Licensing
See copyright & licensing for more info.
ARTIQ files that do not contain a license header are copyrighted by M-Labs Limited and are licensed under LGPLv3+.