3

I'm fairly new to Rally and have been testing it out. I've been looking at their python framework for working with their API. Unfortunately, within the documentation I cannot find a way to add tasks.

Has anyone ever worked with this before, or can anyone suggest an easy way to import tasks via the API? Currently I have a full spreadsheet with tasks that follows their csv template for importing data.

sorin
  • 161,544
  • 178
  • 535
  • 806
  • Hi, Your question is not very clear. I didnt even know what Rally is, I would suggest that you do the following for your question to get a better resonse. 1. Post a link to the documentation you refer to. 2. Post a sample of your data, 3. Your question is not very clear – ismail Sep 20 '12 at 15:10
  • If you notice he tagged his question Rally. You can learn more about Tags and their meanings by clicking on them. – Charles Ferentchak Sep 20 '12 at 20:15

1 Answers1

6

A Rally Task item must be associated with a WorkProduct (customarily an Artifact like HierarchicalRequirement (aka UserStory), Defect or TestCase). Using the pyral toolkit, once you have your Rally instance, get the object refs for the Workspace, Project and WorkProduct that the task is to be associated with, then populate a Python dict with those items along with the other required Task attributes and throw it at Rally.

Task creation recipe:

[insert your boilerplate code for dealing with command line args, Rally options, etc]
rally = Rally(server, username, password, workspace=workspace, project=project)
artifact_ident = args.pop()  # get the FormattedID of an artifact as the Task relation target
wksp = rally.getWorkspace()
proj = rally.getProject()

artifact = rally.get("UserStory", fetch="FormattedID", 
                                  query='FormattedID = "%s"' % artifact_ident,
                                  instance=True)
# for a Task, the Workspace, Project, WorkProduct, Name, State and TaskIndex attributes
# are required. The Workspace, Project and WorkProduct attributes must be supplied as
# valid Rally object references.  
info = { "Workspace"   : wksp.ref,
         "Project"     : proj.ref,
         "WorkProduct" : artifact.ref,
         "Name"        : "Scrape vanilla bean",
         "State"       : "Defined",
         "TaskIndex"   : 1,
         "Description" : "With a dull knife, strip material from the vanilla bean"
       }
task = rally.put('Task', info)
print "Created Task: %s  associated with UserStory %s" % (task.FormattedID, artifact.FormattedID)