def getParentDatasetsOrderedList(self, url, conn, dataset, order_counter):
        """
        check if input dataset has parents,
        check if any of the blocks are already at dst,
        prepare the ordered list and return it.
        url : source DBS url
        dataset : to be migrated dataset
        order_counter: the order in which migration happends.
        """
        ordered_dict = {}
        parentSrcDatasets = self.getSrcDatasetParents(url, dataset)
        if len(parentSrcDatasets) > 0:
            parentSrcDatasetNames = [y['parent_dataset']
                                        for y in parentSrcDatasets]
            for aparentDataset in parentSrcDatasetNames:
                parent_ordered_dict = self.processDatasetBlocks(url, conn,
                                            aparentDataset, order_counter)
		self.logger.debug("************ dict length of parent blocks for the parent dataset %s at level %s" %(aparentDataset, order_counter))
		self.logger.debug(len(parent_ordered_dict))
                if parent_ordered_dict != {}:
                    ordered_dict.update(parent_ordered_dict)
		    self.logger.debug("**** ordered_dict length ****")
		    self.logger.debug(len(ordered_dict))	
                # parents of parent
                pparent_ordered_dict = self.getParentDatasetsOrderedList(url,
                                    conn, aparentDataset, order_counter+1)
		self.logger.debug("************dict length parent parent blocks for the parent dataset %s at level %s" %(aparentDataset, order_counter+1))
		self.logger.debug(len(pparent_ordered_dict))
                if pparent_ordered_dict != {}:
                    ordered_dict.update(pparent_ordered_dict)
	            self.logger.debug("**** ordered_dict length ****")
		    self.logger.debug(len(ordered_dict))	
        return ordered_dict