Skip to content

Commit

Permalink
Small touches in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarcote committed Dec 8, 2022
1 parent e3078c4 commit c12df61
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
21 changes: 13 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
This program runs the full post-processing for a correlated EVN experiment until distribution, following the steps described in the EVN Post-Processing Guide, in a semi-automatic way.
The program would retrieve the experiment code from the current working directory, and the associated Support Scientist from the parent directory. Otherwise they need to be specified manually.
[dim]The program would retrieve the experiment code from the current working directory, and the associated Support Scientist from the parent directory. Otherwise they need to be specified manually.
The user can also specify to run only some of the steps or to start the process from a given step
(for those cases when the process has partially run previously). If the post-processing already run in teh past,
it will automatically continue from the last successful step that run.
[italic]If the post-processing partially run before this execution, it will continue from the last successful step.[/italic]
[italic]If the post-processing partially run before this execution, it will continue from the last successful step.[/italic][/dim]
"""

help_calsources = 'Calibrator sources to use in standardplots (comma-separated, no spaces). ' \
Expand Down Expand Up @@ -306,10 +306,10 @@ def main():
formatter_class=RawTextRichHelpFormatter)
# formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-e', '--expname', type=str, default=None,
help='Name of the EVN experiment (case-insensitive).\nBy default recovered assuming you' \
'are running this from /data0/{supsci}/{EXPNAME}.')
help='Name of the EVN experiment (case-insensitive).\n[dim]By default recovered assuming you' \
' run this from /data0/{supsci}/{EXPNAME}.[/dim]')
parser.add_argument('-jss', '--supsci', type=str, default=None, help='Surname of the EVN Support Scientist.\n' \
'By default recovered assuming you are running this from /data0/{supsci}/{EXPNAME}.')
'[dim]By default recovered assuming you run this from /data0/{supsci}/{EXPNAME}.[/dim]')
parser.add_argument('--j2ms2par', type=str, default=None,
help='Additional attributes for j2ms2 (like the fo:XXXXX).')
parser.add_argument('-v', '--version', action='version', version='%(prog)s {}'.format(__version__))
Expand Down Expand Up @@ -338,9 +338,14 @@ def main():
if args.expname is None:
args.expname = Path.cwd().name

assert env.grep_remote_file('jops@ccs', '/ccs/var/log2vex/MASTER_PROJECTS.LIS', args.expname.upper()) != '', \
f"The experiment name {args.expname} is not recognized (not present in MASTER_PROJECTS). " \
"You may need to manually specify with --expname"
try:
assert env.grep_remote_file('jops@ccs', '/ccs/var/log2vex/MASTER_PROJECTS.LIS', args.expname.upper()) != '', \
f"The experiment name {args.expname} is not recognized (not present in MASTER_PROJECTS). " \
"You may need to manually specify with --expname"
except ValueError as e:
rich.print(f"[italic red]The assumed eperiment code {args.expname} is not recognized.[/italic red]")
rich.print('\n' + description)
sys.exit(0)

if args.supsci is None:
args.supsci = Path.cwd().parent.name
Expand Down
6 changes: 3 additions & 3 deletions evn_postprocess/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ def remote_file_exists(host, path):
raise Exception(f"SSH connection to {host} failed.")


def grep_remote_file(host, file, word):
def grep_remote_file(host, remote_file, word):
"""Runs a grep in a file located in a remote host and returns it.
It may raise ValueError if there is a problem accessing the host or file.
"""
cmd = f"grep {word} {file}"
cmd = f"grep {word} {remote_file}"
process = subprocess.Popen(["ssh", host, cmd], shell=False, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output = process.communicate()[0].decode('utf-8')
if process.returncode != 0:
raise ValueError(f"Errorcode {process.returncode} when reading {file} from {host}.")
raise ValueError(f"Errorcode {process.returncode} when searching for {word} in {remote_file} from {host}.")

return output

Expand Down

0 comments on commit c12df61

Please sign in to comment.