holgerBerger / hpc-workspace

Automatically exported from code.google.com/p/hpc-workspace
GNU General Public License v3.0
18 stars 13 forks source link

Expiration reminder displays WS name incorrectly #30

Closed jansteiner closed 4 years ago

jansteiner commented 5 years ago

The text of the reminder email on our cluster does not tell you which of your WSes is expiring. It always looks like this:

Your workspace db/<Username> on system <Systemname> will expire at <Date>.

but db/<Username> omits the important part of the workspace name.

I assume this comes from a pathname string being split at the first minus sign (ws_expirer, line 326). On our cluster, the DB resides in /work/ws-db/<workspacename>.

My understanding is that using the default settings will always lead to this problem, because the default database foldernames contain minus signs in all example ws.conf files I have seen.

Maybe os.path.basename() isn't used correctly or it's a Python 2/3 problem? Alternatively, why not just use dbentry['workspace'] here and give users the complete workspace folder path? That is what I consider doing on our cluster.

Our Python version is 2.7.5, OS is CentOS 7.4.1708.

holgerBerger commented 4 years ago

I can not really reproduce this...

I try something like

python import os.path dbentryfilename="/ws/ws-db/user-workspace" os.path.basename(dbentryfilename)[os.path.basename(dbentryfilename).find('-')+1:] --- > 'workspace'

after applying os.path.basename, the ws-db is gone, and the first - is the one between username and workspace name.

Do you may be have - in usernames? (is that even possible, not sure...)

my line 326 looks like swsname = os.path.basename(dbentryfilename)[os.path.basename(dbentryfilename).find('-')+1:]

which should give the character following the first - in the filename to the end, not of the path!

Is that also your line?

Am Mo., 28. Okt. 2019 um 13:45 Uhr schrieb jansteiner < notifications@github.com>:

The text of the reminder email on our cluster does not tell you which of your WSes is expiring. It always looks like this:

Your workspace db/ on system will expire at .

but db/ omits the important part of the workspace name.

I assume this comes from a pathname string being split at the first minus sign (ws_expirer, line 326). On our cluster, the DB resides in /work/ws-db/.

My understanding is that using the default settings will always lead to this problem, because the default database foldernames contain minus signs in all example ws.conf files I have seen.

Maybe os.path.basename() isn't used correctly or it's a Python 2/3 problem? Alternatively, why not just use dbentry['workspace'] here and give users the complete workspace folder path? That is what I consider doing on our cluster.

Our Python version is 2.7.5, OS is CentOS 7.4.1708.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/holgerBerger/hpc-workspace/issues/30?email_source=notifications&email_token=ADEY2AVWPYHOYJ6TEC2LUCLQQ3NFRA5CNFSM4JFZUSB2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HUYBXGA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEY2AUD357ANMIR4O5LNS3QQ3NFRANCNFSM4JFZUSBQ .

jansteiner commented 4 years ago

It looks like we are using a different version of the script than I thought. Here is our line 325-326:

send_reminder(smtphost, clustername, dbentryfilename.split('-')[1],expiration,mailaddress)
print "  SEND_REMINDER", dbentryfilename.split('-')[1],expiration,mailaddress

Sorry I missed this difference earlier. Of course that would split at the wrong '-' since it looks at the whole path, unlike the GitHub version.

Either this is an old version or my colleague, who has since left us, changed something.

jansteiner commented 4 years ago

Since this definitely refers to an old version, I'll close it.