asposeProject.TaskLinks.Add


#1

Hello,

I have a performance problem when I include the links in the tasks.
I have the project with about three thousand tasks, and when I include the links, the process greatly increases the total execution time of the process.

In the
link = asposeProject.TaskLinks.Add (predecessor, successor, taskLink, lag);
that’s where the delay happens.

In a project with about 3,000 tasks the process ran for about 9 hours and did not end.

How can I improve this time by assigning the link?

Follow the code:

if (context.SyncConfig.SyncLigacoes && context.SyncConfig.SyncExportar)
{
Project asposeProject = context.AsposeData;
while (context.AsposeData.TaskLinks.Count > 0)
asposeProject.TaskLinks.Remove(context.AsposeData.TaskLinks.First());

ChildTasksCollector collector = new ChildTasksCollector();
TaskUtils.Apply(asposeProject.RootTask, collector, 1);

asposeProject.CalculationMode = CalculationMode.Manual;

Dictionary<string, TaskLinkType> listLink = new Dictionary<string, TaskLinkType>();
listLink.Add("II", TaskLinkType.StartToStart);
listLink.Add("IF", TaskLinkType.StartToStart);
listLink.Add("FF", TaskLinkType.StartToStart);
listLink.Add("FI", TaskLinkType.StartToStart);

TaskLinkType taskLink;
Task predecessora;
Task sucessora;
Duration lag ;
TaskLink link;

foreach (PrjSyncTarefaRelac taskRelac in context.ProjetoTerceiro.TarefaRelacs)
{
	predecessora = PrjSyncTarefaUtils.getTaskObj(taskRelac.Predecessora);
	sucessora = PrjSyncTarefaUtils.getTaskObj(taskRelac.Sucessora);

	taskLink = (listLink.ContainsKey(taskRelac.TipoLigacao)) ? listLink[taskRelac.TipoLigacao] : TaskLinkType.FinishToStart;

	if (predecessora != null && sucessora != null)
	{
		lag = asposeProject.GetDuration(RMSConvert.ToDouble(taskRelac.Defasagem), TimeUnitType.Day);
		link = asposeProject.TaskLinks.Add(predecessora, sucessora, taskLink, lag);
		link.LagFormat = TimeUnitType.Day;
	}
}
asposeProject.CalculationMode = CalculationMode.Automatic;

}


#2

@Helem

It is requested to please provide sample project file so that we could investigate the issue in detail. You may share the file in private by sending in message. The message button shall appear by clicking on my user name.


#3

Hello,
the project is attached.


#4

@Helem

We are unable to locate attached project file. You may share the file using GDrive or DropBox.


#5

Follows the shared file link:
https://drive.google.com/open?id=1EpB5_KMyT8DCluRdQ6PlQ50BJQHzWFXe


#6

@Helem

We do not have permission to download file at this link. Please provide open link so that any of us could access and download.


#7

Here is the link to the shared file:


#8

@Helem

Thank you for providing the project file.
Initially, we have tried to check the performance issue and the output project file is successfully generated in 10 to 15 minutes.
We are working on this and shall update you as soon as we have more information to share.


#9

In my environment the process has been running for more than 25 hours for 5000 tasks and has not finished generating the file.


#10

@Helem

Please let us know which OS, VS version and MS Project version is used to run this application.


#11

@MuzammilKhan

Windows 7 Professional - Service Pack 1
Aspose.Tasks 2018 version 18.4


#12

@Helem

We have logged this issue under ID “TASKSNET-2789” for further investigation. You will automatically be informed here once we have more information to share.


#13

Good Morning,
I downloaded version 18.10 of Aspose.Tasks.dll, and the process has the same behavior as version 18.4.


#14

@Helem

We are working on this issue and we will update you as soon as we have more information to share.


#15

Hello @Helem,

Please try to set project calculation mode to CalculationMode.None and call project.Recalculate() when task links are already added.