forked from qt-creator/qt-creator
TaskTree: Refactor Group internal data
Introduce the GroupData structure. In this way it's easily possible to add extra properties of already used types, e.g. int. It's also possible to easily create elements with multiple properties. Simplify internal TaskItem::Type enum. Get rid of special ParallelLimit and Workflow elements. Provide global parallelLimit() and workflowPolicy() functions. Make global items (e.g. parallel, stopOnDone, etc...) const. Change-Id: Ic5628255b542fd6c5a5565b055ff11804c8d7b68 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -50,6 +50,25 @@ TaskItem onGroupError(const TaskItem::GroupEndHandler &handler)
|
|||||||
return Group::onGroupError(handler);
|
return Group::onGroupError(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TaskItem parallelLimit(int limit)
|
||||||
|
{
|
||||||
|
return Group::parallelLimit(qMax(limit, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskItem workflowPolicy(WorkflowPolicy policy)
|
||||||
|
{
|
||||||
|
return Group::workflowPolicy(policy);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TaskItem sequential = parallelLimit(1);
|
||||||
|
const TaskItem parallel = parallelLimit(0);
|
||||||
|
const TaskItem stopOnError = workflowPolicy(WorkflowPolicy::StopOnError);
|
||||||
|
const TaskItem continueOnError = workflowPolicy(WorkflowPolicy::ContinueOnError);
|
||||||
|
const TaskItem stopOnDone = workflowPolicy(WorkflowPolicy::StopOnDone);
|
||||||
|
const TaskItem continueOnDone = workflowPolicy(WorkflowPolicy::ContinueOnDone);
|
||||||
|
const TaskItem stopOnFinished = workflowPolicy(WorkflowPolicy::StopOnFinished);
|
||||||
|
const TaskItem optional = workflowPolicy(WorkflowPolicy::Optional);
|
||||||
|
|
||||||
static TaskAction toTaskAction(bool success)
|
static TaskAction toTaskAction(bool success)
|
||||||
{
|
{
|
||||||
return success ? TaskAction::StopWithDone : TaskAction::StopWithError;
|
return success ? TaskAction::StopWithDone : TaskAction::StopWithError;
|
||||||
@@ -118,15 +137,6 @@ void TreeStorageBase::activateStorage(int id) const
|
|||||||
m_storageData->m_activeStorage = id;
|
m_storageData->m_activeStorage = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParallelLimit sequential(1);
|
|
||||||
ParallelLimit parallel(0);
|
|
||||||
Workflow stopOnError(WorkflowPolicy::StopOnError);
|
|
||||||
Workflow continueOnError(WorkflowPolicy::ContinueOnError);
|
|
||||||
Workflow stopOnDone(WorkflowPolicy::StopOnDone);
|
|
||||||
Workflow continueOnDone(WorkflowPolicy::ContinueOnDone);
|
|
||||||
Workflow stopOnFinished(WorkflowPolicy::StopOnFinished);
|
|
||||||
Workflow optional(WorkflowPolicy::Optional);
|
|
||||||
|
|
||||||
void TaskItem::addChildren(const QList<TaskItem> &children)
|
void TaskItem::addChildren(const QList<TaskItem> &children)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_type == Type::Group, qWarning("Only Group may have children, skipping...");
|
QTC_ASSERT(m_type == Type::Group, qWarning("Only Group may have children, skipping...");
|
||||||
@@ -136,40 +146,41 @@ void TaskItem::addChildren(const QList<TaskItem> &children)
|
|||||||
case Type::Group:
|
case Type::Group:
|
||||||
m_children.append(child);
|
m_children.append(child);
|
||||||
break;
|
break;
|
||||||
case Type::Limit:
|
case Type::GroupData:
|
||||||
QTC_ASSERT(m_type == Type::Group, qWarning("Execution Mode may only be a child of a "
|
if (child.m_groupData.m_groupHandler.m_setupHandler) {
|
||||||
"Group, skipping..."); return);
|
QTC_ASSERT(!m_groupData.m_groupHandler.m_setupHandler,
|
||||||
m_parallelLimit = child.m_parallelLimit; // TODO: Assert on redefinition?
|
qWarning("Group Setup Handler redefinition, overriding..."));
|
||||||
break;
|
m_groupData.m_groupHandler.m_setupHandler
|
||||||
case Type::Policy:
|
= child.m_groupData.m_groupHandler.m_setupHandler;
|
||||||
QTC_ASSERT(m_type == Type::Group, qWarning("Workflow Policy may only be a child of a "
|
}
|
||||||
"Group, skipping..."); return);
|
if (child.m_groupData.m_groupHandler.m_doneHandler) {
|
||||||
m_workflowPolicy = child.m_workflowPolicy; // TODO: Assert on redefinition?
|
QTC_ASSERT(!m_groupData.m_groupHandler.m_doneHandler,
|
||||||
|
qWarning("Group Done Handler redefinition, overriding..."));
|
||||||
|
m_groupData.m_groupHandler.m_doneHandler
|
||||||
|
= child.m_groupData.m_groupHandler.m_doneHandler;
|
||||||
|
}
|
||||||
|
if (child.m_groupData.m_groupHandler.m_errorHandler) {
|
||||||
|
QTC_ASSERT(!m_groupData.m_groupHandler.m_errorHandler,
|
||||||
|
qWarning("Group Error Handler redefinition, overriding..."));
|
||||||
|
m_groupData.m_groupHandler.m_errorHandler
|
||||||
|
= child.m_groupData.m_groupHandler.m_errorHandler;
|
||||||
|
}
|
||||||
|
if (child.m_groupData.m_parallelLimit) {
|
||||||
|
QTC_ASSERT(!m_groupData.m_parallelLimit,
|
||||||
|
qWarning("Group Execution Mode redefinition, overriding..."));
|
||||||
|
m_groupData.m_parallelLimit = child.m_groupData.m_parallelLimit;
|
||||||
|
}
|
||||||
|
if (child.m_groupData.m_workflowPolicy) {
|
||||||
|
QTC_ASSERT(!m_groupData.m_workflowPolicy,
|
||||||
|
qWarning("Group Workflow Policy redefinition, overriding..."));
|
||||||
|
m_groupData.m_workflowPolicy = child.m_groupData.m_workflowPolicy;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Type::TaskHandler:
|
case Type::TaskHandler:
|
||||||
QTC_ASSERT(child.m_taskHandler.m_createHandler,
|
QTC_ASSERT(child.m_taskHandler.m_createHandler,
|
||||||
qWarning("Task Create Handler can't be null, skipping..."); return);
|
qWarning("Task Create Handler can't be null, skipping..."); return);
|
||||||
m_children.append(child);
|
m_children.append(child);
|
||||||
break;
|
break;
|
||||||
case Type::GroupHandler:
|
|
||||||
QTC_ASSERT(m_type == Type::Group, qWarning("Group Handler may only be a "
|
|
||||||
"child of a Group, skipping..."); break);
|
|
||||||
QTC_ASSERT(!child.m_groupHandler.m_setupHandler
|
|
||||||
|| !m_groupHandler.m_setupHandler,
|
|
||||||
qWarning("Group Setup Handler redefinition, overriding..."));
|
|
||||||
QTC_ASSERT(!child.m_groupHandler.m_doneHandler
|
|
||||||
|| !m_groupHandler.m_doneHandler,
|
|
||||||
qWarning("Group Done Handler redefinition, overriding..."));
|
|
||||||
QTC_ASSERT(!child.m_groupHandler.m_errorHandler
|
|
||||||
|| !m_groupHandler.m_errorHandler,
|
|
||||||
qWarning("Group Error Handler redefinition, overriding..."));
|
|
||||||
if (child.m_groupHandler.m_setupHandler)
|
|
||||||
m_groupHandler.m_setupHandler = child.m_groupHandler.m_setupHandler;
|
|
||||||
if (child.m_groupHandler.m_doneHandler)
|
|
||||||
m_groupHandler.m_doneHandler = child.m_groupHandler.m_doneHandler;
|
|
||||||
if (child.m_groupHandler.m_errorHandler)
|
|
||||||
m_groupHandler.m_errorHandler = child.m_groupHandler.m_errorHandler;
|
|
||||||
break;
|
|
||||||
case Type::Storage:
|
case Type::Storage:
|
||||||
m_storageList.append(child.m_storageList);
|
m_storageList.append(child.m_storageList);
|
||||||
break;
|
break;
|
||||||
@@ -472,9 +483,9 @@ TaskContainer::ConstData::ConstData(TaskTreePrivate *taskTreePrivate, const Task
|
|||||||
: m_taskTreePrivate(taskTreePrivate)
|
: m_taskTreePrivate(taskTreePrivate)
|
||||||
, m_parentNode(parentNode)
|
, m_parentNode(parentNode)
|
||||||
, m_parentContainer(parentContainer)
|
, m_parentContainer(parentContainer)
|
||||||
, m_parallelLimit(task.parallelLimit())
|
, m_parallelLimit(task.groupData().m_parallelLimit.value_or(1))
|
||||||
, m_workflowPolicy(task.workflowPolicy())
|
, m_workflowPolicy(task.groupData().m_workflowPolicy.value_or(WorkflowPolicy::StopOnError))
|
||||||
, m_groupHandler(task.groupHandler())
|
, m_groupHandler(task.groupData().m_groupHandler)
|
||||||
, m_storageList(taskTreePrivate->addStorages(task.storageList()))
|
, m_storageList(taskTreePrivate->addStorages(task.storageList()))
|
||||||
, m_children(createChildren(taskTreePrivate, thisContainer, task))
|
, m_children(createChildren(taskTreePrivate, thisContainer, task))
|
||||||
, m_taskCount(std::accumulate(m_children.cbegin(), m_children.cend(), 0,
|
, m_taskCount(std::accumulate(m_children.cbegin(), m_children.cend(), 0,
|
||||||
@@ -1130,7 +1141,7 @@ void TaskNode::invokeEndHandler(bool success)
|
|||||||
started, without waiting for the previous tasks to finish. In this
|
started, without waiting for the previous tasks to finish. In this
|
||||||
mode, all tasks run simultaneously.
|
mode, all tasks run simultaneously.
|
||||||
\row
|
\row
|
||||||
\li ParallelLimit(int limit)
|
\li parallelLimit(int limit)
|
||||||
\li In this mode, a limited number of direct child tasks run simultaneously.
|
\li In this mode, a limited number of direct child tasks run simultaneously.
|
||||||
The \e limit defines the maximum number of tasks running in parallel
|
The \e limit defines the maximum number of tasks running in parallel
|
||||||
in a group. When the group is started, the first batch tasks is
|
in a group. When the group is started, the first batch tasks is
|
||||||
|
@@ -18,7 +18,6 @@ namespace Tasking {
|
|||||||
|
|
||||||
class ExecutionContextActivator;
|
class ExecutionContextActivator;
|
||||||
class TaskContainer;
|
class TaskContainer;
|
||||||
class TaskNode;
|
|
||||||
class TaskTreePrivate;
|
class TaskTreePrivate;
|
||||||
|
|
||||||
class TASKING_EXPORT TaskInterface : public QObject
|
class TASKING_EXPORT TaskInterface : public QObject
|
||||||
@@ -68,9 +67,9 @@ private:
|
|||||||
int m_storageCounter = 0;
|
int m_storageCounter = 0;
|
||||||
};
|
};
|
||||||
QSharedPointer<StorageData> m_storageData;
|
QSharedPointer<StorageData> m_storageData;
|
||||||
|
friend ExecutionContextActivator;
|
||||||
friend TaskContainer;
|
friend TaskContainer;
|
||||||
friend TaskTreePrivate;
|
friend TaskTreePrivate;
|
||||||
friend ExecutionContextActivator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename StorageStruct>
|
template <typename StorageStruct>
|
||||||
@@ -145,54 +144,50 @@ public:
|
|||||||
GroupEndHandler m_errorHandler = {};
|
GroupEndHandler m_errorHandler = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
int parallelLimit() const { return m_parallelLimit; }
|
struct GroupData {
|
||||||
WorkflowPolicy workflowPolicy() const { return m_workflowPolicy; }
|
GroupHandler m_groupHandler = {};
|
||||||
TaskHandler taskHandler() const { return m_taskHandler; }
|
std::optional<int> m_parallelLimit = {};
|
||||||
GroupHandler groupHandler() const { return m_groupHandler; }
|
std::optional<WorkflowPolicy> m_workflowPolicy = {};
|
||||||
|
};
|
||||||
|
|
||||||
QList<TaskItem> children() const { return m_children; }
|
QList<TaskItem> children() const { return m_children; }
|
||||||
|
GroupData groupData() const { return m_groupData; }
|
||||||
QList<TreeStorageBase> storageList() const { return m_storageList; }
|
QList<TreeStorageBase> storageList() const { return m_storageList; }
|
||||||
|
TaskHandler taskHandler() const { return m_taskHandler; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
Group,
|
Group,
|
||||||
|
GroupData,
|
||||||
Storage,
|
Storage,
|
||||||
Limit,
|
TaskHandler
|
||||||
Policy,
|
|
||||||
TaskHandler,
|
|
||||||
GroupHandler
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TaskItem() = default;
|
TaskItem() = default;
|
||||||
TaskItem(int parallelLimit)
|
TaskItem(const GroupData &data)
|
||||||
: m_type(Type::Limit)
|
: m_type(Type::GroupData)
|
||||||
, m_parallelLimit(parallelLimit) {}
|
, m_groupData(data) {}
|
||||||
TaskItem(WorkflowPolicy policy)
|
|
||||||
: m_type(Type::Policy)
|
|
||||||
, m_workflowPolicy(policy) {}
|
|
||||||
TaskItem(const TaskHandler &handler)
|
|
||||||
: m_type(Type::TaskHandler)
|
|
||||||
, m_taskHandler(handler) {}
|
|
||||||
TaskItem(const GroupHandler &handler)
|
|
||||||
: m_type(Type::GroupHandler)
|
|
||||||
, m_groupHandler(handler) {}
|
|
||||||
TaskItem(const TreeStorageBase &storage)
|
TaskItem(const TreeStorageBase &storage)
|
||||||
: m_type(Type::Storage)
|
: m_type(Type::Storage)
|
||||||
, m_storageList{storage} {}
|
, m_storageList{storage} {}
|
||||||
|
TaskItem(const TaskHandler &handler)
|
||||||
|
: m_type(Type::TaskHandler)
|
||||||
|
, m_taskHandler(handler) {}
|
||||||
void addChildren(const QList<TaskItem> &children);
|
void addChildren(const QList<TaskItem> &children);
|
||||||
|
|
||||||
void setTaskSetupHandler(const TaskSetupHandler &handler);
|
void setTaskSetupHandler(const TaskSetupHandler &handler);
|
||||||
void setTaskDoneHandler(const TaskEndHandler &handler);
|
void setTaskDoneHandler(const TaskEndHandler &handler);
|
||||||
void setTaskErrorHandler(const TaskEndHandler &handler);
|
void setTaskErrorHandler(const TaskEndHandler &handler);
|
||||||
static TaskItem createGroupHandler(const GroupHandler &handler) { return TaskItem(handler); }
|
static TaskItem groupHandler(const GroupHandler &handler) { return TaskItem({handler}); }
|
||||||
|
static TaskItem parallelLimit(int limit) { return TaskItem({{}, limit}); }
|
||||||
|
static TaskItem workflowPolicy(WorkflowPolicy policy) { return TaskItem({{}, {}, policy}); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type m_type = Type::Group;
|
Type m_type = Type::Group;
|
||||||
int m_parallelLimit = 1; // 0 means unlimited
|
|
||||||
WorkflowPolicy m_workflowPolicy = WorkflowPolicy::StopOnError;
|
|
||||||
TaskHandler m_taskHandler;
|
|
||||||
GroupHandler m_groupHandler;
|
|
||||||
QList<TreeStorageBase> m_storageList;
|
|
||||||
QList<TaskItem> m_children;
|
QList<TaskItem> m_children;
|
||||||
|
GroupData m_groupData;
|
||||||
|
QList<TreeStorageBase> m_storageList;
|
||||||
|
TaskHandler m_taskHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TASKING_EXPORT Group : public TaskItem
|
class TASKING_EXPORT Group : public TaskItem
|
||||||
@@ -201,16 +196,19 @@ public:
|
|||||||
Group(const QList<TaskItem> &children) { addChildren(children); }
|
Group(const QList<TaskItem> &children) { addChildren(children); }
|
||||||
Group(std::initializer_list<TaskItem> children) { addChildren(children); }
|
Group(std::initializer_list<TaskItem> children) { addChildren(children); }
|
||||||
|
|
||||||
|
// GroupData related:
|
||||||
template <typename SetupHandler>
|
template <typename SetupHandler>
|
||||||
static TaskItem onGroupSetup(SetupHandler &&handler) {
|
static TaskItem onGroupSetup(SetupHandler &&handler) {
|
||||||
return createGroupHandler({wrapGroupSetup(std::forward<SetupHandler>(handler))});
|
return groupHandler({wrapGroupSetup(std::forward<SetupHandler>(handler))});
|
||||||
}
|
}
|
||||||
static TaskItem onGroupDone(const GroupEndHandler &handler) {
|
static TaskItem onGroupDone(const GroupEndHandler &handler) {
|
||||||
return createGroupHandler({{}, handler});
|
return groupHandler({{}, handler});
|
||||||
}
|
}
|
||||||
static TaskItem onGroupError(const GroupEndHandler &handler) {
|
static TaskItem onGroupError(const GroupEndHandler &handler) {
|
||||||
return createGroupHandler({{}, {}, handler});
|
return groupHandler({{}, {}, handler});
|
||||||
}
|
}
|
||||||
|
using TaskItem::parallelLimit; // Default: 1 (sequential). 0 means unlimited (parallel).
|
||||||
|
using TaskItem::workflowPolicy; // Default: WorkflowPolicy::StopOnError.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename SetupHandler>
|
template<typename SetupHandler>
|
||||||
@@ -240,6 +238,17 @@ static TaskItem onGroupSetup(SetupHandler &&handler)
|
|||||||
|
|
||||||
TASKING_EXPORT TaskItem onGroupDone(const TaskItem::GroupEndHandler &handler);
|
TASKING_EXPORT TaskItem onGroupDone(const TaskItem::GroupEndHandler &handler);
|
||||||
TASKING_EXPORT TaskItem onGroupError(const TaskItem::GroupEndHandler &handler);
|
TASKING_EXPORT TaskItem onGroupError(const TaskItem::GroupEndHandler &handler);
|
||||||
|
TASKING_EXPORT TaskItem parallelLimit(int limit);
|
||||||
|
TASKING_EXPORT TaskItem workflowPolicy(WorkflowPolicy policy);
|
||||||
|
|
||||||
|
TASKING_EXPORT extern const TaskItem sequential;
|
||||||
|
TASKING_EXPORT extern const TaskItem parallel;
|
||||||
|
TASKING_EXPORT extern const TaskItem stopOnError;
|
||||||
|
TASKING_EXPORT extern const TaskItem continueOnError;
|
||||||
|
TASKING_EXPORT extern const TaskItem stopOnDone;
|
||||||
|
TASKING_EXPORT extern const TaskItem continueOnDone;
|
||||||
|
TASKING_EXPORT extern const TaskItem stopOnFinished;
|
||||||
|
TASKING_EXPORT extern const TaskItem optional;
|
||||||
|
|
||||||
class TASKING_EXPORT Storage : public TaskItem
|
class TASKING_EXPORT Storage : public TaskItem
|
||||||
{
|
{
|
||||||
@@ -247,18 +256,6 @@ public:
|
|||||||
Storage(const TreeStorageBase &storage) : TaskItem(storage) { }
|
Storage(const TreeStorageBase &storage) : TaskItem(storage) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TASKING_EXPORT ParallelLimit : public TaskItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ParallelLimit(int parallelLimit) : TaskItem(qMax(parallelLimit, 0)) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
class TASKING_EXPORT Workflow : public TaskItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Workflow(WorkflowPolicy policy) : TaskItem(policy) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Synchronous invocation. Similarly to Group - isn't counted as a task inside taskCount()
|
// Synchronous invocation. Similarly to Group - isn't counted as a task inside taskCount()
|
||||||
class TASKING_EXPORT Sync : public Group
|
class TASKING_EXPORT Sync : public Group
|
||||||
{
|
{
|
||||||
@@ -283,18 +280,8 @@ private:
|
|||||||
}
|
}
|
||||||
return {onGroupSetup([function] { function(); return TaskAction::StopWithDone; })};
|
return {onGroupSetup([function] { function(); return TaskAction::StopWithDone; })};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TASKING_EXPORT extern ParallelLimit sequential;
|
|
||||||
TASKING_EXPORT extern ParallelLimit parallel;
|
|
||||||
TASKING_EXPORT extern Workflow stopOnError;
|
|
||||||
TASKING_EXPORT extern Workflow continueOnError;
|
|
||||||
TASKING_EXPORT extern Workflow stopOnDone;
|
|
||||||
TASKING_EXPORT extern Workflow continueOnDone;
|
|
||||||
TASKING_EXPORT extern Workflow stopOnFinished;
|
|
||||||
TASKING_EXPORT extern Workflow optional;
|
|
||||||
|
|
||||||
template <typename Task>
|
template <typename Task>
|
||||||
class TaskAdapter : public TaskInterface
|
class TaskAdapter : public TaskInterface
|
||||||
{
|
{
|
||||||
|
@@ -360,7 +360,7 @@ void TestCodeParser::scanForTests(const QSet<FilePath> &filePaths,
|
|||||||
|
|
||||||
using namespace Tasking;
|
using namespace Tasking;
|
||||||
|
|
||||||
QList<TaskItem> tasks{ParallelLimit(std::max(QThread::idealThreadCount() / 4, 1))};
|
QList<TaskItem> tasks{parallelLimit(std::max(QThread::idealThreadCount() / 4, 1))};
|
||||||
for (const FilePath &file : filteredFiles) {
|
for (const FilePath &file : filteredFiles) {
|
||||||
const auto setup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
|
const auto setup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
|
||||||
async.setConcurrentCallData(parseFileForTests, codeParsers, file);
|
async.setConcurrentCallData(parseFileForTests, codeParsers, file);
|
||||||
|
@@ -183,7 +183,7 @@ void ClangToolRunWorker::start()
|
|||||||
m_filesAnalyzed.clear();
|
m_filesAnalyzed.clear();
|
||||||
m_filesNotAnalyzed.clear();
|
m_filesNotAnalyzed.clear();
|
||||||
|
|
||||||
QList<TaskItem> tasks{ParallelLimit(qMax(1, m_runSettings.parallelJobs()))};
|
QList<TaskItem> tasks{parallelLimit(qMax(1, m_runSettings.parallelJobs()))};
|
||||||
for (const AnalyzeUnit &unit : std::as_const(unitsToProcess)) {
|
for (const AnalyzeUnit &unit : std::as_const(unitsToProcess)) {
|
||||||
if (!m_diagnosticConfig.isEnabled(tool)
|
if (!m_diagnosticConfig.isEnabled(tool)
|
||||||
&& !m_runSettings.hasConfigFileForSourceFile(unit.file)) {
|
&& !m_runSettings.hasConfigFileForSourceFile(unit.file)) {
|
||||||
|
@@ -450,7 +450,7 @@ void LocatorMatcher::start()
|
|||||||
collectorStorage->m_collector = nullptr;
|
collectorStorage->m_collector = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<TaskItem> parallelTasks { ParallelLimit(d->m_parallelLimit) };
|
QList<TaskItem> parallelTasks {parallelLimit(d->m_parallelLimit)};
|
||||||
|
|
||||||
const auto onSetup = [this, collectorStorage](const TreeStorage<LocatorStorage> &storage,
|
const auto onSetup = [this, collectorStorage](const TreeStorage<LocatorStorage> &storage,
|
||||||
int index) {
|
int index) {
|
||||||
|
@@ -223,7 +223,7 @@ TaskItem QnxDeployQtLibrariesDialogPrivate::chmodTree()
|
|||||||
if (file.isExecutable())
|
if (file.isExecutable())
|
||||||
filesToChmod << file;
|
filesToChmod << file;
|
||||||
}
|
}
|
||||||
QList<TaskItem> chmodList{optional, ParallelLimit(MaxConcurrentStatCalls)};
|
QList<TaskItem> chmodList{optional, parallelLimit(MaxConcurrentStatCalls)};
|
||||||
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
||||||
QTC_ASSERT(file.isValid(), continue);
|
QTC_ASSERT(file.isValid(), continue);
|
||||||
chmodList.append(chmodTask(file));
|
chmodList.append(chmodTask(file));
|
||||||
|
@@ -179,7 +179,7 @@ TaskItem GenericDirectUploadStep::statTree(const TreeStorage<UploadStorage> &sto
|
|||||||
const auto setupHandler = [=](TaskTree &tree) {
|
const auto setupHandler = [=](TaskTree &tree) {
|
||||||
UploadStorage *storagePtr = storage.activeStorage();
|
UploadStorage *storagePtr = storage.activeStorage();
|
||||||
const QList<DeployableFile> files = filesToStat(storagePtr);
|
const QList<DeployableFile> files = filesToStat(storagePtr);
|
||||||
QList<TaskItem> statList{optional, ParallelLimit(MaxConcurrentStatCalls)};
|
QList<TaskItem> statList{optional, parallelLimit(MaxConcurrentStatCalls)};
|
||||||
for (const DeployableFile &file : std::as_const(files)) {
|
for (const DeployableFile &file : std::as_const(files)) {
|
||||||
QTC_ASSERT(file.isValid(), continue);
|
QTC_ASSERT(file.isValid(), continue);
|
||||||
statList.append(statTask(storagePtr, file, statEndHandler));
|
statList.append(statTask(storagePtr, file, statEndHandler));
|
||||||
@@ -256,7 +256,7 @@ TaskItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &st
|
|||||||
if (file.isExecutable())
|
if (file.isExecutable())
|
||||||
filesToChmod << file;
|
filesToChmod << file;
|
||||||
}
|
}
|
||||||
QList<TaskItem> chmodList{optional, ParallelLimit(MaxConcurrentStatCalls)};
|
QList<TaskItem> chmodList{optional, parallelLimit(MaxConcurrentStatCalls)};
|
||||||
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
||||||
QTC_ASSERT(file.isValid(), continue);
|
QTC_ASSERT(file.isValid(), continue);
|
||||||
chmodList.append(chmodTask(file));
|
chmodList.append(chmodTask(file));
|
||||||
|
@@ -265,10 +265,10 @@ void tst_Tasking::testTree_data()
|
|||||||
return [=] { storage->m_log.append({taskId, Handler::Sync}); return success; };
|
return [=] { storage->m_log.append({taskId, Handler::Sync}); return success; };
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto constructSimpleSequence = [=](const Workflow &policy) {
|
const auto constructSimpleSequence = [=](WorkflowPolicy policy) {
|
||||||
return Group {
|
return Group {
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
policy,
|
workflowPolicy(policy),
|
||||||
Test(setupTask(1), logDone),
|
Test(setupTask(1), logDone),
|
||||||
Test(setupFailingTask(2), logDone, logError),
|
Test(setupFailingTask(2), logDone, logError),
|
||||||
Test(setupTask(3), logDone),
|
Test(setupTask(3), logDone),
|
||||||
@@ -632,7 +632,7 @@ void tst_Tasking::testTree_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const Group root = constructSimpleSequence(stopOnError);
|
const Group root = constructSimpleSequence(WorkflowPolicy::StopOnError);
|
||||||
const Log log {
|
const Log log {
|
||||||
{1, Handler::Setup},
|
{1, Handler::Setup},
|
||||||
{1, Handler::Done},
|
{1, Handler::Done},
|
||||||
@@ -644,7 +644,7 @@ void tst_Tasking::testTree_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const Group root = constructSimpleSequence(continueOnError);
|
const Group root = constructSimpleSequence(WorkflowPolicy::ContinueOnError);
|
||||||
const Log log {
|
const Log log {
|
||||||
{1, Handler::Setup},
|
{1, Handler::Setup},
|
||||||
{1, Handler::Done},
|
{1, Handler::Done},
|
||||||
@@ -658,7 +658,7 @@ void tst_Tasking::testTree_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const Group root = constructSimpleSequence(stopOnDone);
|
const Group root = constructSimpleSequence(WorkflowPolicy::StopOnDone);
|
||||||
const Log log {
|
const Log log {
|
||||||
{1, Handler::Setup},
|
{1, Handler::Setup},
|
||||||
{1, Handler::Done},
|
{1, Handler::Done},
|
||||||
@@ -668,7 +668,7 @@ void tst_Tasking::testTree_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const Group root = constructSimpleSequence(continueOnDone);
|
const Group root = constructSimpleSequence(WorkflowPolicy::ContinueOnDone);
|
||||||
const Log log {
|
const Log log {
|
||||||
{1, Handler::Setup},
|
{1, Handler::Setup},
|
||||||
{1, Handler::Done},
|
{1, Handler::Done},
|
||||||
@@ -682,7 +682,7 @@ void tst_Tasking::testTree_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const Group root = constructSimpleSequence(stopOnFinished);
|
const Group root = constructSimpleSequence(WorkflowPolicy::StopOnFinished);
|
||||||
const Log log {
|
const Log log {
|
||||||
{1, Handler::Setup},
|
{1, Handler::Setup},
|
||||||
{1, Handler::Done},
|
{1, Handler::Done},
|
||||||
@@ -787,7 +787,7 @@ void tst_Tasking::testTree_data()
|
|||||||
|
|
||||||
{
|
{
|
||||||
const Group root {
|
const Group root {
|
||||||
ParallelLimit(2),
|
parallelLimit(2),
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Group {
|
Group {
|
||||||
onGroupSetup(groupSetup(1)),
|
onGroupSetup(groupSetup(1)),
|
||||||
@@ -821,7 +821,7 @@ void tst_Tasking::testTree_data()
|
|||||||
|
|
||||||
{
|
{
|
||||||
const Group root {
|
const Group root {
|
||||||
ParallelLimit(2),
|
parallelLimit(2),
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Group {
|
Group {
|
||||||
onGroupSetup(groupSetup(1)),
|
onGroupSetup(groupSetup(1)),
|
||||||
@@ -861,7 +861,7 @@ void tst_Tasking::testTree_data()
|
|||||||
|
|
||||||
{
|
{
|
||||||
const Group root1 {
|
const Group root1 {
|
||||||
ParallelLimit(2),
|
parallelLimit(2),
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Group {
|
Group {
|
||||||
onGroupSetup(groupSetup(1)),
|
onGroupSetup(groupSetup(1)),
|
||||||
@@ -890,7 +890,7 @@ void tst_Tasking::testTree_data()
|
|||||||
// - task 1 should be stopped as a consequence of the error inside the group
|
// - task 1 should be stopped as a consequence of the error inside the group
|
||||||
// - tasks 4 and 5 should be skipped
|
// - tasks 4 and 5 should be skipped
|
||||||
const Group root2 {
|
const Group root2 {
|
||||||
ParallelLimit(2),
|
parallelLimit(2),
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Group {
|
Group {
|
||||||
onGroupSetup(groupSetup(1)),
|
onGroupSetup(groupSetup(1)),
|
||||||
@@ -926,7 +926,7 @@ void tst_Tasking::testTree_data()
|
|||||||
continueOnError,
|
continueOnError,
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Group {
|
Group {
|
||||||
ParallelLimit(2),
|
parallelLimit(2),
|
||||||
Group {
|
Group {
|
||||||
onGroupSetup(groupSetup(1)),
|
onGroupSetup(groupSetup(1)),
|
||||||
Test(setupSleepingTask(1, true, 20ms))
|
Test(setupSleepingTask(1, true, 20ms))
|
||||||
@@ -968,7 +968,7 @@ void tst_Tasking::testTree_data()
|
|||||||
|
|
||||||
{
|
{
|
||||||
const Group root {
|
const Group root {
|
||||||
ParallelLimit(2),
|
parallelLimit(2),
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Group {
|
Group {
|
||||||
Storage(TreeStorage<CustomStorage>()),
|
Storage(TreeStorage<CustomStorage>()),
|
||||||
@@ -1018,7 +1018,7 @@ void tst_Tasking::testTree_data()
|
|||||||
|
|
||||||
{
|
{
|
||||||
const Group root {
|
const Group root {
|
||||||
ParallelLimit(2),
|
parallelLimit(2),
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Group {
|
Group {
|
||||||
Storage(TreeStorage<CustomStorage>()),
|
Storage(TreeStorage<CustomStorage>()),
|
||||||
@@ -1064,7 +1064,7 @@ void tst_Tasking::testTree_data()
|
|||||||
|
|
||||||
{
|
{
|
||||||
const Group root {
|
const Group root {
|
||||||
ParallelLimit(2),
|
parallelLimit(2),
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Group {
|
Group {
|
||||||
Storage(TreeStorage<CustomStorage>()),
|
Storage(TreeStorage<CustomStorage>()),
|
||||||
@@ -1278,7 +1278,7 @@ void tst_Tasking::testTree_data()
|
|||||||
// as in SEQUENTIAL mode the next task may only be started after the previous one finished.
|
// as in SEQUENTIAL mode the next task may only be started after the previous one finished.
|
||||||
// In this case, the previous task (Group element) awaits for the barrier's advance to
|
// In this case, the previous task (Group element) awaits for the barrier's advance to
|
||||||
// come from the not yet started next task, causing a deadlock.
|
// come from the not yet started next task, causing a deadlock.
|
||||||
// The minimal requirement for this scenario to succeed is to set ParallelLimit(2) or more.
|
// The minimal requirement for this scenario to succeed is to set parallelLimit(2) or more.
|
||||||
const Group root3 {
|
const Group root3 {
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Storage(barrier),
|
Storage(barrier),
|
||||||
@@ -1434,7 +1434,7 @@ void tst_Tasking::testTree_data()
|
|||||||
// as in SEQUENTIAL mode the next task may only be started after the previous one finished.
|
// as in SEQUENTIAL mode the next task may only be started after the previous one finished.
|
||||||
// In this case, the previous task (Group element) awaits for the barrier's advance to
|
// In this case, the previous task (Group element) awaits for the barrier's advance to
|
||||||
// come from the not yet started next task, causing a deadlock.
|
// come from the not yet started next task, causing a deadlock.
|
||||||
// The minimal requirement for this scenario to succeed is to set ParallelLimit(2) or more.
|
// The minimal requirement for this scenario to succeed is to set parallelLimit(2) or more.
|
||||||
const Group root3 {
|
const Group root3 {
|
||||||
Storage(storage),
|
Storage(storage),
|
||||||
Storage(barrier),
|
Storage(barrier),
|
||||||
|
@@ -171,14 +171,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
const Group root {
|
const Group root {
|
||||||
rootGroup->executeMode(),
|
rootGroup->executeMode(),
|
||||||
Workflow(rootGroup->workflowPolicy()),
|
workflowPolicy(rootGroup->workflowPolicy()),
|
||||||
onGroupSetup([rootGroup] { rootGroup->setState(State::Running); }),
|
onGroupSetup([rootGroup] { rootGroup->setState(State::Running); }),
|
||||||
onGroupDone([rootGroup] { rootGroup->setState(State::Done); }),
|
onGroupDone([rootGroup] { rootGroup->setState(State::Done); }),
|
||||||
onGroupError([rootGroup] { rootGroup->setState(State::Error); }),
|
onGroupError([rootGroup] { rootGroup->setState(State::Error); }),
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
groupTask_1->executeMode(),
|
groupTask_1->executeMode(),
|
||||||
Workflow(groupTask_1->workflowPolicy()),
|
workflowPolicy(groupTask_1->workflowPolicy()),
|
||||||
onGroupSetup([groupTask_1] { groupTask_1->setState(State::Running); }),
|
onGroupSetup([groupTask_1] { groupTask_1->setState(State::Running); }),
|
||||||
onGroupDone([groupTask_1] { groupTask_1->setState(State::Done); }),
|
onGroupDone([groupTask_1] { groupTask_1->setState(State::Done); }),
|
||||||
onGroupError([groupTask_1] { groupTask_1->setState(State::Error); }),
|
onGroupError([groupTask_1] { groupTask_1->setState(State::Error); }),
|
||||||
@@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
|||||||
taskItem(task_3),
|
taskItem(task_3),
|
||||||
Group {
|
Group {
|
||||||
groupTask_4->executeMode(),
|
groupTask_4->executeMode(),
|
||||||
Workflow(groupTask_4->workflowPolicy()),
|
workflowPolicy(groupTask_4->workflowPolicy()),
|
||||||
onGroupSetup([groupTask_4] { groupTask_4->setState(State::Running); }),
|
onGroupSetup([groupTask_4] { groupTask_4->setState(State::Running); }),
|
||||||
onGroupDone([groupTask_4] { groupTask_4->setState(State::Done); }),
|
onGroupDone([groupTask_4] { groupTask_4->setState(State::Done); }),
|
||||||
onGroupError([groupTask_4] { groupTask_4->setState(State::Error); }),
|
onGroupError([groupTask_4] { groupTask_4->setState(State::Error); }),
|
||||||
@@ -200,7 +200,7 @@ int main(int argc, char *argv[])
|
|||||||
taskItem(task_4_2),
|
taskItem(task_4_2),
|
||||||
Group {
|
Group {
|
||||||
groupTask_4_3->executeMode(),
|
groupTask_4_3->executeMode(),
|
||||||
Workflow(groupTask_4_3->workflowPolicy()),
|
workflowPolicy(groupTask_4_3->workflowPolicy()),
|
||||||
onGroupSetup([groupTask_4_3] { groupTask_4_3->setState(State::Running); }),
|
onGroupSetup([groupTask_4_3] { groupTask_4_3->setState(State::Running); }),
|
||||||
onGroupDone([groupTask_4_3] { groupTask_4_3->setState(State::Done); }),
|
onGroupDone([groupTask_4_3] { groupTask_4_3->setState(State::Done); }),
|
||||||
onGroupError([groupTask_4_3] { groupTask_4_3->setState(State::Error); }),
|
onGroupError([groupTask_4_3] { groupTask_4_3->setState(State::Error); }),
|
||||||
|
@@ -165,7 +165,7 @@ void GroupWidget::updateExecuteMode()
|
|||||||
m_executeCombo->setCurrentIndex(m_executeCombo->findData((int)m_executeMode));
|
m_executeCombo->setCurrentIndex(m_executeCombo->findData((int)m_executeMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
Tasking::ParallelLimit GroupWidget::executeMode() const
|
Tasking::TaskItem GroupWidget::executeMode() const
|
||||||
{
|
{
|
||||||
return m_executeMode == ExecuteMode::Sequential ? Tasking::sequential : Tasking::parallel;
|
return m_executeMode == ExecuteMode::Sequential ? Tasking::sequential : Tasking::parallel;
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ public:
|
|||||||
GroupWidget();
|
GroupWidget();
|
||||||
|
|
||||||
void setExecuteMode(ExecuteMode mode);
|
void setExecuteMode(ExecuteMode mode);
|
||||||
Tasking::ParallelLimit executeMode() const;
|
Tasking::TaskItem executeMode() const;
|
||||||
|
|
||||||
void setWorkflowPolicy(Tasking::WorkflowPolicy policy);
|
void setWorkflowPolicy(Tasking::WorkflowPolicy policy);
|
||||||
Tasking::WorkflowPolicy workflowPolicy() const;
|
Tasking::WorkflowPolicy workflowPolicy() const;
|
||||||
|
Reference in New Issue
Block a user