Skip to content
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

ENH: add getPVAliases and grep_more_ioc scripts #180

Merged
merged 23 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d400a57
ENH: Added script for reconstructing PV aliases
aberges-SLAC Apr 22, 2024
05ab06e
MNT: Fixed relative path reference on getPVAliases wrapper
aberges-SLAC Apr 22, 2024
c9df901
STY: conform to flake8 DOC: type hint returns ENH: consolidate bash s…
aberges-SLAC Apr 24, 2024
e2e7300
MNT: read hutch codes from '...pyps/config'
aberges-SLAC Apr 24, 2024
35474cb
ENH: Added grep_more_ioc.py and associated shell wrapper, simiplified…
aberges-SLAC May 14, 2024
0c19339
BUG: Fixed bugs on parent release prints and fixed rel. path in shell…
aberges-SLAC May 14, 2024
9d028c3
MNT: flake8, general style, shellcheck
aberges-SLAC May 14, 2024
7eb1c33
MNT: Fixed help doctext for grep_more_ioc argparser
aberges-SLAC May 14, 2024
655c7b9
MNT: Proper quoting for in grep_more_ioc.sh
aberges-SLAC May 14, 2024
607a972
MNT: sort imports for style enforcement
aberges-SLAC May 14, 2024
f31039f
MNT: isort, once more with feeling
aberges-SLAC May 14, 2024
04d62b3
MNT: isort is not my friend
aberges-SLAC May 14, 2024
07eb6f7
BUG: Fixed bad catches on find_parent_ioc in grep_more_ioc.py
aberges-SLAC May 14, 2024
fa19600
MAINT: Various bugfixing, style fixing, incorporating review changes
aberges-SLAC May 17, 2024
d183294
STY: flake8 and isort compliance
aberges-SLAC May 17, 2024
43d391f
MAINT: One last bug fix and style fix
aberges-SLAC May 17, 2024
ad07b6f
MAINT: more style fixing
aberges-SLAC May 17, 2024
122d4ff
BUG/ENH: Fixed missing IOCs due to inline breaks. Added search_procmg…
aberges-SLAC May 20, 2024
06a21bb
DOC: Improved help documentation for grep_more_ioc and getPVAliases
aberges-SLAC May 21, 2024
b2037ed
DOC: Updated README.md to include new scripts
aberges-SLAC May 21, 2024
e3bfae4
DOC: Update README.md
aberges-SLAC May 22, 2024
09fd47e
MAINT: Rename getPVAliases.sh to getPVAliases
aberges-SLAC May 22, 2024
be4e07e
MAINT: Rename grep_more_ioc.sh to grep_more_ioc
aberges-SLAC May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,33 @@ usage: grep_ioc KEYWORD [hutch]<br/>
</td>
</tr>

<tr>
<td>grep_more_ioc</td>
<td>
usage: grep_more_ioc [-h] [-d] patt hutch {print,search} <br/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script is actually grep_more_ioc.sh, I think we should document as such here or rename the scripts to not have .sh suffixes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd vote to not have .sh as most scripts in engineering tools do not have extensions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To hop on to the readme suggestions, could you add an example call for those of us who don't know what pattern/hutch to search for? I think examples are helpful for people not so familiar with EPICS and our systems

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if this script renaming/examples stuff get in then this PR has my approval (I don't want to hold it up any longer, but I'd like the names to be finalized + I'd like people to be ready to use it when it gets merged)

positional arguments: <br/>
patt Regex str to search through iocmanager.cfg<br/>
e.g. 'mcs2', 'lm2k2-atm.*', 'ek9000', 'gige.*'<br/>
hutch 3 letter hutch code to search through.<br/>
Use 'all' to search through all hutches.
-h, --help Show help message and exit<br/>
-d, --ignore_disabled Exclude IOCs based on disabled state <br/>
Necessary subcommands.<br/>
Use: grep_more_ioc . all [subcommand] --help for more information
{print, search}<br/>
print Prints all the matching IOCs in a dataframe<br/>
-h, --help Show help message and exit<br/>
-c, --skip_comments Prints IOC.cfg file with comments skipped<br/>
-r, --release Includes the parent IOC release in the dataframe<br/>
-s, --print_dirs Dump child & parent directors to the terminal<br/>
-y, --print_history Dump child IOC's history to terminal, if it exists<br/>
search Regex-like search of child IOCs<br/>
PATT The regex str to use in the search<br/>
-h, --help Show help message and exit<br/>
-q, --quiet Surpresses file warning for paths that do not exist<br/>
-o, --only_search Skip printing dataframe, only print search results<br/>
</tr>

<tr>
<td>grep_pv</td>
<td>
Expand Down Expand Up @@ -308,7 +335,8 @@ usage: ioctool &lt;ioc&gt;|&lt;pv&gt; [option]<br/>
telnet : starts a telnet session with the ioc<br/>
pvs : opens the IOC.pvlist file in less<br/>
</td>
</tr>

</tr>

<tr>
<td>ipmConfigEpics</td>
Expand Down Expand Up @@ -640,9 +668,9 @@ Optional arguments:<br/>

<tr>
<td> set_gem_timing</td>
<td>
<td>
Usage: set_gem_timing [SC or NC]
</td>
</tr>

</table>
</table>
26 changes: 26 additions & 0 deletions scripts/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
Constants used in grep_more_ioc and getPVAliases
"""
###############################################################################
# %% Imports
###############################################################################

import glob as gb

###############################################################################
# %% Constants
###############################################################################

# Check the directories for the iocmanager config file
VALID_HUTCH = sorted([d for d in gb.glob('/cds/group/pcds/pyps/config'
+ '/*/')
if gb.glob(d + 'iocmanager.cfg')])
# Trim to 3 letter hutch code, include 'all' = '*'
VALID_HUTCH = ['all'] + [s.rsplit(r'/', maxsplit=2)[-2] for s in VALID_HUTCH]

# Keys from iocmanager. Found in /cds/group/pcds/config/*/iocmanager/utils.py
# Update this as needed
DEF_IMGR_KEYS = ['procmgr_config', 'hosts', 'dir', 'id', 'cmd',
'flags', 'port', 'host', 'disable', 'history',
'delay', 'alias', 'hard']
Loading