本文整理汇总了Python中pxStats.lib.StatsPaths.StatsPaths.getStatsPathFromMachine方法的典型用法代码示例。如果您正苦于以下问题:Python StatsPaths.getStatsPathFromMachine方法的具体用法?Python StatsPaths.getStatsPathFromMachine怎么用?Python StatsPaths.getStatsPathFromMachine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pxStats.lib.StatsPaths.StatsPaths
的用法示例。
在下文中一共展示了StatsPaths.getStatsPathFromMachine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: transfer
# 需要导入模块: from pxStats.lib.StatsPaths import StatsPaths [as 别名]
# 或者: from pxStats.lib.StatsPaths.StatsPaths import getStatsPathFromMachine [as 别名]
def transfer( login, machine ):
"""
@summary : Transfers all the required files
from specified machine into local
machine.
Every task is done 10 times.
This is done in hope that everything
downloaded will be as coherent as possible.
If a large amount of file is to
be transferred, some files that were downloaded
at the beginning of the transfer,wich can take
up to a few hours,might not be as up to date as
the file downloaded towards the end of the transfer
"""
statsPaths = StatsPaths()
statsPaths.setPaths()
localPaths = getLocalPathsToSynchronise()
buildLocalPaths( localPaths )
configFiles = getConfigFiles()
for i in range( 10 ):
transferLogFiles()
for localPath in localPaths :
remotePath = statsPaths.getStatsPathFromMachine( localPath, machine, login )
print "rsync -avzr --delete-before -e ssh %[email protected]%s:%s %s" %( login, machine, remotePath, localPath )
output = commands.getoutput( "rsync -avzr --delete-before -e ssh %[email protected]%s:%s %s" %( login, machine, remotePath, localPath ) )
print output
for configfile in configFiles:
#get real path
localPath = os.path.dirname( configfile )
fileName = os.path.basename( configfile )
remotePath = statsPaths.getStatsPathFromMachine( localPath, machine, login )
print "rsync -avzr --delete-before -e ssh %[email protected]%s:%s %s" %( login, machine, remotePath + fileName, localPath + fileName )
output = commands.getoutput( "rsync -avzr --delete-before -e ssh %[email protected]%s:%s %s" %( login, machine, remotePath + fileName, localPath + fileName ) )
print output