Skip to content

Upgrading CMOST to latest pyarchon version #5

@hpearnshaw

Description

@hpearnshaw

Currently the CMOST machine (and GROVER, having a direct copy from that machine) is on an old python 2 version of pyarchon from 2021. I'd like to get this up-to-date with the latest python 3 compatible version which will save us the hassle of switching back and forth between python versions all the time, and I don't think it will require much if anything to change in the cmost-analysis code. Before we can do so, though, there are a couple of local modifications on the CMOST machine that need addressing, in cmost.py and interface.py (I don't know who made them). Below I put down some of what I found doing a git diff on the modified files in the local pyarchon repository on CMOST (located at /home/user/CMOST/pyarchon).

In interface.py (though I'm not sure we even use this, as opposed to cmost.py?) there are the following additions, which look like adding padding to the command string:

@@ -380,6 +380,7 @@ def __send_threaded_command(hostnum, command):
              ( command,                      \
                hosts.camname[hostnum], hosts.camhost[hostnum] )
     try:
+        command = command + "\n"
         hosts.camsocket[hostnum].sendall( command.encode() )
     except:
         print "unable to send command. host may be down."
@@ -409,8 +410,11 @@ def __send_command(*arg_list):
     command = []
     for arg in arg_list:
         command.append(str(arg))
+    command.append(endchar)
     command = ' '.join(command)
 
+    print command
+
     if (not hosts.camsocket):
         print "ERROR: no connected sockets"
         return 1, ""

In cmost.py there is also some of this, plus changing "POWERON" and "POWEROFF" commands to "native POWERON" and "native POWEROFF", as well as the following which looks like it's addressing a timeout issue:

@@ -461,7 +461,8 @@ def __send_command(*arg_list):
         # read the first 4 bytes which give the message length
         while True:
             try:
-                ready = select.select([sendsocket[ii]],[],[],toTime)
+#               ready = select.select([sendsocket[ii]],[],[],toTime)
+                ready = select.select([sendsocket[ii]],[],[])             # omit timeout
             except select.error:
                 print "select error"
                 break

The full git diff output is here: pyarchon_diff.txt

So my question is: are these changes that have made their way into the current version of pyarchon or are they changes that we want to preserve and re-apply to an upgraded version of pyarchon? If we're lucky, we can just upgrade pyarchon and all of this will come with - if not, there will be some extra work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions