当前位置: 首页>>代码示例>>Python>>正文


Python Rally.enableLogging方法代码示例

本文整理汇总了Python中pyral.Rally.enableLogging方法的典型用法代码示例。如果您正苦于以下问题:Python Rally.enableLogging方法的具体用法?Python Rally.enableLogging怎么用?Python Rally.enableLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyral.Rally的用法示例。


在下文中一共展示了Rally.enableLogging方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    if len(args) != 1:
        errout(USAGE)
        sys.exit(1)

    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging("rally.history.uptask")

    taskID = args.pop()   # for this example use the FormattedID
    print "attempting to update Task: %s" % taskID


    target_workspace = rally.getWorkspace()
    target_project   = rally.getProject()

    info = {
                "FormattedID"   : taskID,
                "State" : "In-Progress"
           }

##    print info   

    try:
        task = rally.update('Task', info)
    except RallyRESTAPIError, details:
        sys.stderr.write('ERROR: %s \n' % details)
        sys.exit(2)
开发者ID:nmusaelian-rally,项目名称:rally-python-api-examples,代码行数:35,代码来源:n_uptask.py

示例2: Avant_Rally

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
class Avant_Rally(object):
	iterations = []
	rally = None

	def __init__(self, project):
		self.project = project

	def connect(self, username, password):
		self.rally = Rally(server, user, password, project=self.project)
		self.rally.enableLogging('rally.simple-use.log')

	def fetch_Iterations(self):
		self.iterations = []

		response = self.rally.get('Iteration', fetch=True)

		for rls in response:
		    iter = Iteration()
		    rlsStart = rls.StartDate.split('T')[0]  # just need the date part
		    rlsDate  = rls.EndDate.split('T')[0]       # ditto
		    self.iterations.append(iter.set_Iteration(rlsStart, rlsDate, rls.Name, rls.PlannedVelocity, self.rally))

	def display_Iterations(self):
		for i in self.iterations:
		    print "\n\n%s   %s  -->  %s\t" % \
		          (i.name, i.start_date, i.end_date)
		    i.display_User_Stories(i.name)
开发者ID:samacart,项目名称:Rally,代码行数:29,代码来源:rally.py

示例3: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def main(args):

    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    if not args:
        print  USAGE
        sys.exit(9)
    # specify the Rally server and credentials
    server, username, password, workspace, project = rallySettings(options)
    #print " ".join(["|%s|" % opt for opt in [server, username, '********', workspace]])
    rally = Rally(server, user=username, password=password, workspace=workspace, warn=False)
    rally.enableLogging('rally.hist.chgsets')  # name of file you want the logging to go to

    repo_name = args.pop(0)
    since = None
    if args:
        since = args.pop(0)
        try:
            days = int(since)
            now = time.time()
            since_ts = now - (days * 86400)
            since = time.strftime("%Y-%m-%dT%H:%M:%S.000Z", time.gmtime(since_ts))
        except:
            since = None

    showRepoItems(rally, repo_name, workspace=workspace, limit=ITEM_LIMIT, since_date=since)
开发者ID:bimsapi,项目名称:RallyRestToolkitForPython,代码行数:28,代码来源:repoitems.py

示例4: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]

    server, user, password, workspace, project = rallySettings(options)
    rally = Rally(server, user, password, workspace=workspace)
    rally.enableLogging("rally.history.blddefs")

    for workspace, project in wps:
        print "workspace: %s  project: %s" % (workspace, project)
        rally.setWorkspace(workspace)
        response = rally.get('BuildDefinition', fetch=True, 
                             order='Name',
                             workspace=workspace, 
                             project=project)
        if response.errors:
            print response.errors
            sys.exit(9)

        for builddef in response:
            if builddef.Project.Name != project:
                continue
            if builddef.LastStatus == "NO BUILDS":
                print "NO BUILDS"
                continue
            #print builddef.oid, builddef.Name, builddef.LastStatus
            lbt = builddef.LastBuild.CreationDate.split('T')
            last_build_time = "%s %s" % (lbt[0], lbt[1][:5] )
            bd_name = "%-24.24s" % builddef.Name
            status  = "%-10.10s" % builddef.LastStatus
            print builddef.oid, builddef.CreationDate[:10], \
                  bd_name, status, last_build_time, len(builddef.Builds)

        print "\n"
开发者ID:M1ntcraft3r,项目名称:RallyRestToolkitForPython,代码行数:35,代码来源:builddefs.py

示例5: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def main(args):

    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    if not args:
        print  USAGE
        sys.exit(9)
    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging('rally.hist.chgsets')  # name of file you want the logging to go to

    repo_name = args.pop(0)
    since = None
    if args:
        since = args.pop(0)
        try:
            days = int(since)
            now = time.time()
            since_ts = now - (days * 86400)
            since = time.strftime("%Y-%m-%dT%H:%M:%S.000Z", time.gmtime(since_ts))
        except:
            since = None

    showRepoItems(rally, repo_name, workspace=workspace, limit=ITEM_LIMIT, since_date=since)
开发者ID:Cyrilplus,项目名称:RallyRestToolkitForPython,代码行数:29,代码来源:repoitems.py

示例6: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, user, password, workspace, project = rallySettings(options)
    print " ".join(["|%s|" % item for item in [server, user, '********', workspace, project]])
    rally = Rally(server, user, password, workspace=workspace, project=project)
    rally.enableLogging('rally.hist.statecount')  # name of file you want logging to go to

    if not args:
        errout(USAGE)
        sys.exit(1)

    rally.setWorkspace(workspace)
    rally.setProject(project)

    artifact_type = args[0]
    if artifact_type not in VALID_ARTIFACT_TYPES:
        errout(USAGE)
        errout('The artifact_type argument must be one of: %s\n' % ", ".join(VALID_ARTIFACT_TYPES))
        sys.exit(1)
        
    art_type = artifact_type[:]
    state = 'State'  # default to this and change below if necessary
    if artifact_type in ['Story', 'UserStory', 'HierarchicalRequirement']:
        artifact_type = 'HierarchicalRequirement'
        state = 'ScheduleState'

    t_zero = time.time()
    state_values = rally.getAllowedValues(artifact_type, state)
    t_one = time.time()
    av_time = t_one - t_zero

    show_counts(rally, artifact_type, state, state_values, av_time)
开发者ID:bimsapi,项目名称:RallyRestToolkitForPython,代码行数:35,代码来源:statecounts.py

示例7: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]

    server, user, password, workspace, project = rallySettings(options)
    rally = Rally(server, user, password, workspace=workspace)
    rally.enableLogging("rally.history.blddefs")

    for workspace, project in wps:
        rally.setWorkspace(workspace)
        print "workspace: %s  project: %s\n" % (workspace, project)
        response = rally.get('BuildDefinition', fetch=True, 
                             query='Project.Name = "%s"' % project, 
                             order='Name', workspace=workspace, project=project)
        if response.errors:
            print response.errors
            sys.exit(9)

        print "%-12.12s   %-10.10s  %-36.36s %12s  %-20.20s  %s" % \
              ('BuildDef OID', 'CreateDate', 'BuildDefinition.Name', 'LastStatus', 'LastBuildDateTime', 'NumBuilds')
        print "%-12.12s   %-10.10s  %-36.36s   %10s  %-19.19s   %s" % \
              ('-' * 12, '-' * 10, '-' * 36, '-' * 10, '-' * 19, '-' * 9)
        for builddef in response:
            if builddef.LastStatus == "NO BUILDS":
                print "%s %s %-24.24s NO BUILDS" % \
                      (builddef.oid, builddef.CreationDate[:10], builddef.Name)
                continue
            lbt = builddef.LastBuild.CreationDate.split('T')
            last_build_time = "%s %s" % (lbt[0], lbt[1][:8] )
            bdf = "%12.12s   %-10.10s  %-36.36s %12s  %-20.20s    %4s"
            print bdf % (builddef.oid, builddef.CreationDate[:10], 
                  builddef.Name, builddef.LastStatus, last_build_time,
                  len(builddef.Builds))
开发者ID:bimsapi,项目名称:RallyRestToolkitForPython,代码行数:34,代码来源:builddefs.py

示例8: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, user, password, workspace, project = rallySettings(options)
    #print " ".join(["|%s|" % item for item in [server, user, '********', workspace, project]])
    rally = Rally(server, user, password, workspace=workspace, warn=False)
    rally.enableLogging('rally.hist.articount')  # name of file you want logging to go to
    prog_opts = [opt for opt in args if opt.startswith('-')]
    byproject = False
    if '-byproject' in prog_opts:
        byproject = True
    
    #if not args:
    #    errout(USAGE)
    #    sys.exit(1)

    print ""
    workspaces = rally.getWorkspaces()
    for wksp in workspaces:
        rally.setWorkspace(wksp.Name)
        print wksp.Name
        print "=" * len(wksp.Name)
        projects = [None]
        if byproject:
            projects = rally.getProjects(workspace=wksp.Name)
        for project in projects:
            if project:
                print ""
                print project.Name
                print "    %s" % ('-' * len(project.Name))
            for artifact_type in COUNTABLE_ARTIFACT_TYPES:
                count = getArtifactCount(rally, artifact_type, project=project)
                print "       %-16.16s : %4d items" % (artifact_type, count)
        print ""
开发者ID:M1ntcraft3r,项目名称:RallyRestToolkitForPython,代码行数:36,代码来源:wkspcounts.py

示例9: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, user, password, workspace, project = rallySettings(options)
    #print " ".join(["|%s|" % item for item in [server, user, '********', workspace, project]])
    rally = Rally(server, user, password, workspace=workspace, warn=False)
    target_workspace, byproject, art_types = processCommandLineArguments(args)
    rally.enableLogging('rally.hist.articount')  # name of file you want logging to go to
    
    workspaces = rally.getWorkspaces()
    if target_workspace != 'all':
        hits = [wksp for wksp in workspaces if wksp.Name == target_workspace]
        if not hits:
            problem = "The specified target workspace: '%s' either does not exist or is not accessible"
            errout("ERROR: %s\n" % (problem % target_workspace))
            sys.exit(2)
        workspaces = hits

    for wksp in workspaces:
        print wksp.Name
        print "=" * len(wksp.Name)
        rally.setWorkspace(wksp.Name)
        projects = [None]
        if byproject:
            projects = rally.getProjects(workspace=wksp.Name)
        for project in projects:
            if project:
                print ""
                print "    %s" % project.Name
                print "    %s" % ('-' * len(project.Name))
            for artifact_type in art_types:
                count = getArtifactCount(rally, artifact_type, project=project)
                print "       %-16.16s : %4d items" % (artifact_type, count)
        print ""
开发者ID:bimsapi,项目名称:RallyRestToolkitForPython,代码行数:36,代码来源:wkspcounts.py

示例10: get_story

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def get_story(formatted_id):
    r = Rally(server, apikey=apikey, project=project)
    r.enableLogging('rally.log')
    aa = r.get('UserStory',
               fetch=True,
               query='FormattedID = "' + formatted_id + '"',
               instance=True)
    return dict_from_story(aa)
开发者ID:jayalane,项目名称:rally-utils,代码行数:10,代码来源:rally.py

示例11: get_rally_connection

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def get_rally_connection(USER, PASSWORD, PROJECT, VERSION='1.43', SERVER='rally1.rallydev.com'):
    ''' return a rally connection object '''

    # get the rally connection object
    rally = Rally(SERVER, USER, PASSWORD, version=VERSION, project=PROJECT)
    rally.enableLogging('/tmp/rally.log')

    return rally
开发者ID:mancdaz,项目名称:crap,代码行数:10,代码来源:utils.py

示例12: rallyLogin

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
 def rallyLogin(self):
     server = 'rally1.rallydev.com'
     user = '[email protected]'
     password = 'sp1LSZA4UBNm'
     project = 'MBH - HNL'
     workspace = 'default'
     rally = Rally(server, user, password, workspace=workspace, project=project)
     rally.enableLogging('mypyral.log')
     return rally
开发者ID:CmWork,项目名称:RallyScripts,代码行数:11,代码来源:EndOfSprintReport.py

示例13: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging("rally.hist.add_tcrs")

    if len(args) < 2:
        errout(USAGE)
        sys.exit(1)
    test_case_id, tcr_info_filename = args
    if not os.path.exists(tcr_info_filename):
        errout("ERROR:  file argument '%s' does not exist.  Respecify using corrent name or path\n" % tcr_info_filename)
        errout(USAGE)
        sys.exit(2)
    try:
        with open(tcr_info_filename, 'r') as tcif:
            content = tcif.readlines()
        tcr_info = []
        # each line must have Build, Date, Verdict
        for ix, line in enumerate(content):
            fields = line.split(',')
            if len(fields) != 3:
                raise Exception('Line #%d has invalid number of fields: %s' % (ix+1, repr(fields)))
            tcr_info.append([field.strip() for field in fields])
    except Exception:
        errout("ERROR: reading file '%s'.  Check the permissions or the content format for correctness." % tcr_info_filename)
        errout(USAGE)
        sys.exit(2)

    test_case = rally.get('TestCase', query="FormattedID = %s" % test_case_id,
                          workspace=workspace, project=None, instance=True)
    if not test_case or hasattr(test_case, 'resultCount'):
        print "Sorry, unable to find a TestCase with a FormattedID of %s in the %s workspace" % \
              (test_case_id, workspace)
        sys.exit(3)

    wksp = rally.getWorkspace()

    for build, run_date, verdict in tcr_info:
        tcr_data = { "Workspace" : wksp.ref,
                     "TestCase"  : test_case.ref,
                     "Build"     : build,
                     "Date"      : run_date,
                     "Verdict"   : verdict
                   }
        try:
            tcr = rally.create('TestCaseResult', tcr_data)
        except RallyRESTAPIError, details:
            sys.stderr.write('ERROR: %s \n' % details)
            sys.exit(4)
        
        print "Created  TestCaseResult OID: %s  TestCase: %s  Build: %s  Date: %s  Verdict: %s" % \
               (tcr.oid, test_case.FormattedID, tcr.Build, tcr.Date, tcr.Verdict)
开发者ID:Cyrilplus,项目名称:RallyRestToolkitForPython,代码行数:59,代码来源:add_tcrs.py

示例14: __init__

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
class RallyClient:

	rally = None
	debug = False
	PrefixActionMap = {"US": "HierarchicalRequirement", "DE": "Defect" }

	def __init__(self, config):
		self.rally = Rally(config.rallyUrl, config.username, config.password, workspace="Betfair", project="Betfair")
		self.rally.enableLogging('rallycli.log')
		self.debug = config.debug

	def retrieveItems(self, itemIds):
		''' Use pyral to retrieve items from Rally. '''
		items = {}
		for itemId in itemIds:
			query_criteria = 'formattedID = "%s"' % itemId
			prefix = itemId[0:2]
			response = self.rally.get(self.PrefixActionMap[prefix], fetch=True, query=query_criteria)
			if self.debug:
				print response.content
			if response.errors:
			    sys.stdout.write("\n".join(response.errors))
			    print "ERROR"
			    sys.exit(1)
			for item in response:  # there should only be one qualifying item
				# items[itemId] = item
			    # print "%s: %s (%s)" % (item.FormattedID, item.Name, item.Project.Name)
			    items[item.FormattedID] = item
		return items

	def info(self, args):
		''' Return information for specified work items, in a variety of formats. '''
		itemIds = args.workItems
		# print "Retrieving items %s..." % (itemIds)
		items = self.retrieveItems(itemIds)
		for itemId, item in items.iteritems():
			if item == None:
				print "ERROR: Could not retrieve item %s from Rally" % itemId
			else:
				# print item.attributes()
				# print item.ObjectID
				# @TODO Refactor these into configurable/dynamic values
				baseUrl = "https://rally1.rallydev.com/#"
				workspaceId = "3254856811d"
				itemUrl = "%s/%s/detail/userstory/%s" % (baseUrl, workspaceId, item.ObjectID)
				if args.format == "confluence" :
					print "# [%s: %s|%s]" % (itemId, item.Name, itemUrl)
				elif args.format == "conftable" :
					print "| %s | %s | %s |" % (itemId, item.Name, itemUrl)
				elif args.format == "csv":
					print "%s,%s,%s" % (itemId, item.Name, itemUrl)
				elif args.format == "tsv":
					print "%s\t%s\t%s" % (itemId, item.Name, itemUrl)
				else:
					print "%s: %s (%s)" % (itemId, item.Name, itemUrl)
开发者ID:duffj,项目名称:rallycli.py,代码行数:57,代码来源:client.py

示例15: make_story

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import enableLogging [as 别名]
def make_story(story_name, story_detail, username):
    r = Rally(server, apikey=apikey, project=project)
    r.enableLogging('rally.log')
    wksp = r.getWorkspace()
    proj = r.getProject(project)
    info = {"Workspace":   wksp.ref,
            "Project":     proj.ref,
            "Name":        story_name + " (web intake form from " + username + ")",
            "Story Type":  "New Feature",
            "Description": story_detail}
    story = r.put('Story', info)
    return dict_from_story(story)
开发者ID:jayalane,项目名称:rally-utils,代码行数:14,代码来源:rally.py


注:本文中的pyral.Rally.enableLogging方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。