Skip to content

[WIP][v6r20] Added StorageElement.getOccupancy#3572

Closed
fstagni wants to merge 25 commits into
DIRACGrid:integrationfrom
fstagni:spaceTokenUsage
Closed

[WIP][v6r20] Added StorageElement.getOccupancy#3572
fstagni wants to merge 25 commits into
DIRACGrid:integrationfrom
fstagni:spaceTokenUsage

Conversation

@fstagni

@fstagni fstagni commented Dec 8, 2017

Copy link
Copy Markdown
Contributor

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

@fstagni fstagni requested a review from atsareg as a code owner December 8, 2017 16:27
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.01%) to 19.862% when pulling a2fdd92 on fstagni:spaceTokenUsage into e78e42e on DIRACGrid:integration.

@fstagni fstagni changed the title [WIP] [v6r20] Added StorageElement.getOccupancy [v6r20] Added StorageElement.getOccupancy Dec 11, 2017
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.003%) to 19.869% when pulling 5965036 on fstagni:spaceTokenUsage into e78e42e on DIRACGrid:integration.

spaceTokenEndpoint, spaceToken = params['Value']

se = StorageElement(self.args['name'])
occupancyResult = se.getOccupancy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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!")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StorageBase.getOccupancy

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well all the other return codes in this module contains Storage.method:so I just left it like the others.

Comment thread Resources/Storage/GFAL2_SRM2Storage.py Outdated

return S_OK( protocolsList )

def getOccupancy(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No no, there is no lcg_utils anymore.
I will provide you with an implementation for that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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" }'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh is it just a context?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread Resources/Storage/DIPStorage.py Outdated
""" Gets the DIPStorage occupancy info
"""
rpc = RPCClient(self.getURLBase(), timeout=120)
free = rpc.getFreeDiskSpace("/")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the parameter ?
Shouldn't the StorageElementHandler answer with the space free on the partition where it stores its data ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's the path, basically it will export the result of st = os.statvfs(path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Then I would say it is incorrect. Take LogSE as an example: it has a special partition

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I see, and I agree with you. I just discussed it with Andrei, he will implement this properly.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.004%) to 19.878% when pulling acb03a6 on fstagni:spaceTokenUsage into e8a7701 on DIRACGrid:integration.

…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
  ...
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.003%) to 19.871% when pulling fbd0783 on fstagni:spaceTokenUsage into e8a7701 on DIRACGrid:integration.

@fstagni fstagni changed the title [v6r20] Added StorageElement.getOccupancy [WIP][v6r20] Added StorageElement.getOccupancy Dec 13, 2017
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.008%) to 19.868% when pulling b11fba1 on fstagni:spaceTokenUsage into 2855339 on DIRACGrid:integration.

* 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:
  styled
  bug fix (double return)
  DMS: fix bad merge of ReplicateAndRegister
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 19.88% when pulling ce2ed75 on fstagni:spaceTokenUsage into e58ba72 on DIRACGrid:integration.

@fstagni fstagni changed the title [WIP][v6r20] Added StorageElement.getOccupancy [v6r20] Added StorageElement.getOccupancy Dec 20, 2017
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.008%) to 19.876% when pulling 2c249d7 on fstagni:spaceTokenUsage into e58ba72 on DIRACGrid:integration.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 19.88% when pulling f3aa637 on fstagni:spaceTokenUsage into e58ba72 on DIRACGrid:integration.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.006%) to 19.875% when pulling 397c2e6 on fstagni:spaceTokenUsage into e58ba72 on DIRACGrid:integration.

* 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
@fstagni

fstagni commented Jan 15, 2018

Copy link
Copy Markdown
Contributor Author

I resolved the conflicts, please review.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.02%) to 19.857% when pulling 5f15112 on fstagni:spaceTokenUsage into 101301c on DIRACGrid:integration.

@fstagni fstagni changed the title [v6r20] Added StorageElement.getOccupancy [WIP][v6r20] Added StorageElement.getOccupancy Jan 18, 2018
types_getFreeDiskSpace = [basestring]
def export_getFreeDiskSpace( self, path, size = 'TB' ):

def export_getFreeDiskSpace(self, path):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I will do it because I am working against your branch but...

  • The docstring needs updating
  • In all the plugins, you wrote MB or Should 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

@fstagni

fstagni commented Jan 22, 2018

Copy link
Copy Markdown
Contributor Author

Replaced by #3601

@fstagni fstagni closed this Jan 22, 2018
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

Successfully merging this pull request may close these issues.

3 participants