def main(self): """ A replacable main function. If you wish to use the data loader features of this class, you'll need to edit the code at the bottom of this file. This one is basically connects to the database and then attempts to fire up the pairing process. GNOME doesn't use hierarchical project descriptions, so this should not be nearly as big of a deal that we force the parent to be none. """ options, args = self.parser.parse_args() self.log.setLevel(getattr(logging, options.loglevel.upper())) # connect to the database self.log.debug("connecting to database: %s - debug=%s", options.uri, options.debug) connect(options.uri, debug=options.debug, autocommit=False) try: self.community = Community.select(Community.q.name==options.community)[0] # pylint: disable-msg=E1101 except IndexError: self.log.error("Unable to find community \"%s\"", options.community) sys.exit() self.unknowncorp = Corporation.select(Corporation.q.name=="unknown")[0] # pylint: disable-msg=E1101 projects = MasterProject.select(AND(MasterProject.q.communityID==self.community.id, # pylint: disable-msg=E1101 MasterProject.q.parentID==None)) # pylint: disable-msg=E1101 for project in projects: self.link_project(project)
def main(): """ Default handler for importing all of the eclipse data """ parser = OptionParser() parser.add_option("--dburi", "-u", dest="uri", help="database name to connect to", default="postgres://"+os.getenv("USER")+"@/cvsminer", action="store") parser.add_option("-l", "--loglevel", dest="loglevel", help="Manually specify logging level (DEBUG, INFO, WARN, etc)", default="INFO", action="store") parser.add_option("-d", "--debug", action="store_true", dest="debug", default=False, help="sqlobject debugging messages") parser.add_option("--cvsroot", dest="cvsroot", help="root CVS directory", action="store", default="/home/data/eclipse/cvsroot") parser.add_option("--test", dest="test", help="test system by importing a particular file", action="store", default=None) parser.add_option("--masterproject", dest="testmasterproject", help="test system master project name", action="store", default=None) parser.add_option("--project", dest="testproject", help="test system project name", action="store", default=None) parser.add_option("--usecache", dest="usecache", help="if a text dump of cvsps exists, use it", action="store_true", default=False) (options, args) = parser.parse_args() # IGNORE:W0612 log.setLevel(getattr(logging, options.loglevel.upper())) # connect to the database log.debug("connecting to database: %s - debug=%s", options.uri, options.debug) connect(options.uri, debug=options.debug, autocommit=False) community = get_community("eclipse") if options.test or options.testmasterproject or options.testproject: if not (options.test and options.testmasterproject and options.testproject): show_test_error() sys.exit() log.info("running tests") process_test(community=community, infile=options.test, masterproject=options.testmasterproject, project=options.testproject) else: master_projects = get_repositories(options.cvsroot) for mproject in master_projects: process_repository(cvsroot=options.cvsroot, repo=mproject, community=community, cache=options.usecache)
def main(self): """ A replacable main function. If you wish to use the data loader features of this class, you'll need to edit the code at the bottom of this file. """ options, args = self.parser.parse_args() self.log.setLevel(getattr(logging, options.loglevel.upper())) # connect to the database self.log.debug("connecting to database: %s - debug=%s", options.uri, options.debug) connect(options.uri, debug=options.debug, autocommit=False) self.community = self.get_community("eclipse") self.process_files()
def main(self): """ Generic main handler for the network maker. Connects to the database, gets the involvments, calls the network maker, save the network. Awesome. """ options, args = self.parser.parse_args() # these options can be specified via the command line or through the defaults self.outputdir = options.outputdir self.communityname = options.community self.log.setLevel(getattr(logging, options.loglevel.upper())) # connect to the database self.log.debug("connecting to database: %s - debug=%s", options.uri, options.debug) connect(options.uri, debug=options.debug, autocommit=False) community = Community.select(Community.q.name==self.communityname)[0] #pylint: disable-msg=E1101 # get the set of projects if we have filter options projectset = self.get_project_set(community, options.mincommits, options.mindevelopers, options.mincorps) # pylint: disable-msg=E1101 if projectset: print len(projectset) involvement = ProjectInvolvement.select(AND(ProjectInvolvement.q.projectID == MasterProject.q.id, #pylint: disable-msg=E1101 MasterProject.q.communityID == community.id, # pylint: disable-msg=E1101 IN(MasterProject.q.id, projectset)), # pylint: disable-msg=E1101 distinct=True) else: involvement = ProjectInvolvement.select(AND(ProjectInvolvement.q.projectID == MasterProject.q.id, #pylint: disable-msg=E1101 MasterProject.q.communityID == community.id), # pylint: disable-msg=E1101 distinct=True) self.log.info("ProjectInvolvement count: %d", involvement.count()) ctr = 0 if involvement.count() > 0: for devinv in involvement: ctr = ctr + 1 self.add_involvement(devinv) if ctr%100 == 0: self.log.info("processing involvement %d", ctr) else: self.log.error("No developer involvement found, exiting") sys.exit() # multiply out the corporate involvement self.multiply_corporate_participation() # create the output directory if not os.path.isdir(self.outputdir): os.makedirs(self.outputdir) outputnetwork = ETs.ElementTreeSerializer().toString(self.network) outfile = open(self.outputdir + os.sep + "%s.dynetml" % (self.communityname), "w") outfile.write(outputnetwork) outfile.close() # now, dump all of the networks, yowza self.save_nodenames() for network in self.graphs.itervalues(): self.save_graph(network)