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

Revise in-hutch camera check from camViewer script #205

Open
ZLLentz opened this issue Oct 1, 2024 · 3 comments
Open

Revise in-hutch camera check from camViewer script #205

ZLLentz opened this issue Oct 1, 2024 · 3 comments

Comments

@ZLLentz
Copy link
Member

ZLLentz commented Oct 1, 2024

Expected Behavior

The checks in our scripts should be meaningful and correct to give us proper feedback

Current Behavior

There's a place in camViewer where we check if the camera name exists in a hutch via counting and then compare the count to the camera name, which is incorrect. If the line is changed to store the camera name instead of the count we still have some issues because the following checks are a bit wonky.

This gives a confusing printout but doesn't break the script because regardless of the result of the check we proceed anyway.

tmp=/tmp/cv.$$
list_cams "$hutch" >$tmp
c=$(wc <$tmp | grep "$CAMNAME" $tmp | awk '{print $1}')
if [ "$c" == '' ]; then
echo "Camera name not found in hutch. To see which cameras you can access from your current machine use the '-l/--list' option."
sleep 3
elif [ "$c" == "$CAMNAME" ] && [ "$hutch" != "$(get_info --gethutch)" ] ; then
echo "To use camera controls, you must be on the same hutch machine as your camera."
echo "Opening read-only main screen..."
sleep 3
rm -f $tmp
fi

Possible Solution

Revise as appropriate

Context

Originally posted by @ZLLentz in #204 (comment)

@KaushikMalapati
Copy link
Contributor

Slightly unrelated, but I also noticed that the tmp file is deleted in the else block but not in the if block even though it probably should be.
[kaushikm@rix-control scripts]$ ls -lt /tmp/cv.* -rw-rw-r-- 1 opperman gu 251 Sep 27 13:41 /tmp/cv.2019 -rw-rw-r-- 1 opperman gu 251 Sep 27 13:14 /tmp/cv.16521 -rw-rw-r-- 1 rixopr xs 251 Sep 24 13:45 /tmp/cv.23019 -rw-rw-r-- 1 rixopr xs 251 Sep 24 10:11 /tmp/cv.26842
Although, the files are probably deleted regularly anyways since they are in /tmp/.

@ZLLentz
Copy link
Member Author

ZLLentz commented Oct 2, 2024

I missed that, good catch!
It's also probably worth considering whether we can stop using the temp file entirely by grepping through the list_cams output directly

@silkenelson
Copy link
Collaborator

Please make sure list cam makes sense. When working on getting my fork up-to-date, I deleted a dev version of the camviewer that really cleaned these lists up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants