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

Upload/download probe for rucio client #272 #273

Merged

Conversation

nikmagini
Copy link
Contributor

Merge: 94fc77c 6b75e85

Copy link
Contributor

@mlassnig mlassnig left a comment

Choose a reason for hiding this comment

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

So the probe does the right thing, that's good, thanks! Just a few minor comments regarding code style, nothing major. Also, can you switch to 4-spaces, instead of what I see as 8-tab?

PS: please rename the pull-request so we know what it is about ;-) also, this is a general rucio-clients test probe, not specific to ruciomover

Probe to check read/write with all protocols on target RSE with rucio client
'''

import os
Copy link
Contributor

Choose a reason for hiding this comment

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

we sort our imports alphabetically

python native imports first
then python native imports with from clause

blank line

python external imports
python external from imports

blank line

rucio imports
rucio imports with from clause

:param protocol - transfer protocol
:param scope - file scope
:param lfn - file lfn
:param no_register - skip file registration in Rucio; also disables auto-deletion at lifetime expiration
Copy link
Contributor

Choose a reason for hiding this comment

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

missing one space on vertical alignment ;-)

:param scope: file scope
:param lfn: file lfn
:param dst: local destination directory
:param pfn: file pfn (required when the downloaded file is not registered in Rucio
Copy link
Contributor

Choose a reason for hiding this comment

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

same ;-)

:param dst: local destination directory
:param pfn: file pfn (required when the downloaded file is not registered in Rucio
"""
pfnOption=''
Copy link
Contributor

Choose a reason for hiding this comment

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

variable names always_in_camel_case

raise Exception('stageIn failed -- rucio download did not succeed: %s' % o.replace('\n', ''))


OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3
Copy link
Contributor

Choose a reason for hiding this comment

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

should be moved into a python main

skip_download=False
if not args.download_uploaded:
repcli = ReplicaClient()
reps = [r for r in repcli.list_replicas([{'scope': args.download.split(':')[0], 'name': args.download.split(':')[1]}])]
Copy link
Contributor

Choose a reason for hiding this comment

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

split long lines on commas

if not args.download_uploaded:
repcli = ReplicaClient()
reps = [r for r in repcli.list_replicas([{'scope': args.download.split(':')[0], 'name': args.download.split(':')[1]}])]
if len(reps)==0 or rse not in reps[0]['rses'].keys():
Copy link
Contributor

Choose a reason for hiding this comment

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

if not reps instead of len(reps)==0


report[prot['scheme']]={'upload':'UNKNOWN', 'download':'UNKNOWN'}

filename='%s.nagios-check_ruciomover.%s.%s.%s.%s' % (scope, rse, prot['scheme'], timestamp, fileuuid)
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation?

os.unlink(filename)
continue

dst='download/%s.%s.%s' % (rse, prot['scheme'], timestamp)
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation?


dst='download/%s.%s.%s' % (rse, prot['scheme'], timestamp)

pfntodownload=None
Copy link
Contributor

Choose a reason for hiding this comment

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

camel_case

@nikmagini nikmagini changed the title Merge: 94fc77c 6b75e85 Upload/download probe for rucio client #272 Dec 4, 2017
@mlassnig
Copy link
Contributor

mlassnig commented Dec 5, 2017

Just in case you haven't seen it, you can look at the Travis errors in detail. This is what's left:

tools/probes/common/check_ruciomover:31:1: E302 expected 2 blank lines, found 1

tools/probes/common/check_ruciomover:54:1: E302 expected 2 blank lines, found 1

tools/probes/common/check_ruciomover:84:1: E302 expected 2 blank lines, found 1

tools/probes/common/check_ruciomover:85:9: F841 local variable 'WARNING' is assigned to but never used

tools/probes/common/check_ruciomover:169:47: E231 missing whitespace after ':'

tools/probes/common/check_ruciomover:169:69: E231 missing whitespace after ':'

tools/probes/common/check_ruciomover:179:66: E231 missing whitespace after ':'

tools/probes/common/check_ruciomover:179:80: E231 missing whitespace after ':'

tools/probes/common/check_ruciomover:219:13: E303 too many blank lines (2)

tools/probes/common/check_ruciomover:234:13: E303 too many blank lines (2)

tools/probes/common/check_ruciomover:261:1: E305 expected 2 blank lines after class or function definition, found 1

@mlassnig
Copy link
Contributor

mlassnig commented Dec 6, 2017

Down to one problem :-)

tools/probes/common/check_ruciomover:298:1: E305 expected 2 blank lines after class or function definition, found 1

@vingar
Copy link
Contributor

vingar commented Dec 6, 2017

you can install locally the pre-commit hook to get such errors before
With ./tools/configure_git.sh
or
cp tools/pre-commit .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

@nikmagini
Copy link
Contributor Author

Thanks for the notification, fixed, somehow flake8 didn't report it for me... Anyway I'm now also setting up the development env properly

@mlassnig
Copy link
Contributor

mlassnig commented Dec 6, 2017

can you do

git fetch --all
git rebase upstream/master

and then try again with pylint -E on your local install?

@nikmagini nikmagini force-pushed the patch-272-Probes__272__Add_ruciomover_probe branch from 85a05a7 to c1e1618 Compare December 6, 2017 14:07
@nikmagini
Copy link
Contributor Author

Done, and also took the opportunity to squash my commits into a single one. I didn't get any errors from pylint -E, let's see if Travis agrees.

@bari12 bari12 merged commit 69ee754 into rucio:master Dec 6, 2017
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.

None yet

4 participants