[WIP][v6r20] Added StorageElement.getOccupancy#3572
Conversation
| spaceTokenEndpoint, spaceToken = params['Value'] | ||
|
|
||
| se = StorageElement(self.args['name']) | ||
| occupancyResult = se.getOccupancy |
| :returns: S_OK/S_ERROR dictionary | ||
| """ | ||
| #FIXME: put an implementation that just gets a file and check its content | ||
| return S_ERROR("Storage.occupancy: implement me!") |
There was a problem hiding this comment.
Well all the other return codes in this module contains Storage.method:so I just left it like the others.
|
|
||
| return S_OK( protocolsList ) | ||
|
|
||
| def getOccupancy(self): |
There was a problem hiding this comment.
No no, there is no lcg_utils anymore.
I will provide you with an implementation for that
There was a problem hiding this comment.
I am not sure what exactly you are expecting.
Is this ok ?
In [14]: ctx.getxattr('srm://srm-eoslhcb.cern.ch', 'spacetoken.token?LHCb-EOS')
Out[14]: '{ "spacetoken": "LHCb-EOS", "owner": "lhcb", "totalsize": -1, "unusedsize": 429499145907438, "usedsize": 0, "guaranteedsize": 5000000000000000, "lifetimeleft": -1, "retention": "REPLICA", "accesslatency": "ONLINE" }'
There was a problem hiding this comment.
And what is ctx? Trying on lxplus:
In [47]: import ctx
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-47-56f9a9ccee81> in <module>()
----> 1 import ctx
ImportError: No module named ctx
There was a problem hiding this comment.
Oh is it just a context?
There was a problem hiding this comment.
yes. But as I said if you want I can implement it, I was just asking if these are the info you were looking for.
There was a problem hiding this comment.
Alright so let's do that this is merged, and then it's left to be correctly implemented. What's is added here right now (lcg_util) is what is used today to calculate the space left for space tokens. It works properly so I am not sure why you say that "there's no lcg_utils anymore". The call you posted seems showing the same result, but honestly I didn't properly check, and also it should be seen if the results are consistent among several type of SEs.
There was a problem hiding this comment.
lcg_util is gfal version 1, it is deprecated and should not be used, that's what I meant.
OK, as soon as it is merged, I will implement the correct version
| """ Gets the DIPStorage occupancy info | ||
| """ | ||
| rpc = RPCClient(self.getURLBase(), timeout=120) | ||
| free = rpc.getFreeDiskSpace("/") |
There was a problem hiding this comment.
What is the parameter ?
Shouldn't the StorageElementHandler answer with the space free on the partition where it stores its data ?
There was a problem hiding this comment.
It's the path, basically it will export the result of st = os.statvfs(path)
There was a problem hiding this comment.
Then I would say it is incorrect. Take LogSE as an example: it has a special partition
There was a problem hiding this comment.
Yes I see, and I agree with you. I just discussed it with Andrei, he will implement this properly.
…Usage * origin/spaceTokenUsage: (26 commits) Conflicts resolved Resolved conflicts v6r19p9 v6r19p9 notes testing on protocol using base types allow also space-separated arguments allow giving list of requests in a file using URLBase for everything but SRM2 case when an SE is at no sites added some doc added protection just style use resolveSEGroup avoid instantiating all local SEs marked getStorageElementOptions as deprecated style also considering CEs, not only SEs style docs and pylints ...
* upstream/integration: (25 commits) v6r19p10, v6r20-pre10 v6r19p10 v6r20-pre10 wrap lines better fix isinstance Added warning log message in case of exception log the delay only set delay once again logging fix logging delay execution if no active replicas found delay execution by 1 h if no active replicas found print NotBefore use defaultdict Catch exception when closing closed connection few more logging changes less logging in DM transfers limit logging fix case when no site is found for SE don't try and get SE metadata if replica is inactive ...
* upstream/integration: v6r19p11 v6r20-pre10 notes v6r19p11 notes using python modules always removing the sandboxes of deleted jobs just style just style added doc about shifterProxy 64 chars instead of 32 new option --Force to reset even non-failed requests + accept job IDs from a file new option --Maximum to limit the number of jobs selected + autopep8 autopep8 reset the NotBefore field for all requests when --Reset is used make pylint happier with data members RMS: add missing JOIN in the web summary query style fixed exception handling
|
I resolved the conflicts, please review. |
| types_getFreeDiskSpace = [basestring] | ||
| def export_getFreeDiskSpace( self, path, size = 'TB' ): | ||
|
|
||
| def export_getFreeDiskSpace(self, path): |
There was a problem hiding this comment.
I will do it because I am working against your branch but...
- The docstring needs updating
- In all the plugins, you wrote
MBorShould be MB. Shall we take the opportunity and make it MB or TB everywhere ?
If up to now srm was returning TB, we shall do TB, because probably many plots rely on that
|
Replaced by #3601 |
This PR adds a
StorageElement.getOccupancy()call, and then use it inside the RSS.This is not supposed to be a complete work. It just adds the general interface, which should be applied for all type of SEs. Some "FIXME" comment are there and can be only be resolved later.
BEGINRELEASENOTES
*Resources
NEW: Added StorageElement.getOccupancy() method for DIP and GFAL2_SMR2 SE types
*RSS
CHANGE: Using StorageElement.getOccupancy()
ENDRELEASENOTES