Skip to content

Commit

Permalink
ENH: Refactor and clean up manual retry infrastructure
Browse files Browse the repository at this point in the history
ENH: Add job status logging to the detail logging window
ENH: Enable thumbnail generation in worker processes
BUG: Fix missing update of server settings UI
BUG: Add missing Python wrapping methods for ctkJobDetail
ENH: Enhance job logging for better traceability
PERF: Optimize UI updates by directly calling component slots
  • Loading branch information
Punzo committed Sep 6, 2024
1 parent 6292d09 commit 8afb5c3
Show file tree
Hide file tree
Showing 58 changed files with 2,344 additions and 1,061 deletions.
15 changes: 14 additions & 1 deletion Libs/Core/ctkAbstractJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ctkAbstractJob::ctkAbstractJob()
this->MaximumConcurrentJobsPerType = 20;
this->Priority = QThread::Priority::LowPriority;
this->CreationDateTime = QDateTime::currentDateTime();
this->DestroyAfterUse = false;
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -218,7 +219,7 @@ QString ctkAbstractJob::loggedText() const
}

//----------------------------------------------------------------------------
void ctkAbstractJob::setLoggedText(QString loggedText)
void ctkAbstractJob::addLoggedText(QString loggedText)
{
if (loggedText.isEmpty())
{
Expand All @@ -228,6 +229,18 @@ void ctkAbstractJob::setLoggedText(QString loggedText)
this->LoggedText += loggedText;
}

//----------------------------------------------------------------------------
bool ctkAbstractJob::destroyAfterUse() const
{
return this->DestroyAfterUse;
}

//----------------------------------------------------------------------------
void ctkAbstractJob::setDestroyAfterUse(bool destroyAfterUse)
{
this->DestroyAfterUse = destroyAfterUse;
}

//----------------------------------------------------------------------------
QVariant ctkAbstractJob::toVariant()
{
Expand Down
18 changes: 15 additions & 3 deletions Libs/Core/ctkAbstractJob.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class CTK_CORE_EXPORT ctkAbstractJob : public QObject
Q_PROPERTY(QDateTime startDateTime READ startDateTime);
Q_PROPERTY(QDateTime completionDateTime READ completionDateTime);
Q_PROPERTY(QString runningThreadID READ runningThreadID WRITE setRunningThreadID);
Q_PROPERTY(QString loggedText READ loggedText WRITE setLoggedText);
Q_PROPERTY(QString loggedText READ loggedText WRITE addLoggedText);
Q_PROPERTY(bool destroyAfterUse READ destroyAfterUse WRITE setDestroyAfterUse);

public:
explicit ctkAbstractJob();
Expand Down Expand Up @@ -158,7 +159,7 @@ class CTK_CORE_EXPORT ctkAbstractJob : public QObject
///@{
/// Logged Text
QString loggedText() const;
void setLoggedText(QString loggedText);
void addLoggedText(QString loggedText);
///@}

/// Generate worker for job
Expand All @@ -168,7 +169,7 @@ class CTK_CORE_EXPORT ctkAbstractJob : public QObject
Q_INVOKABLE virtual ctkAbstractJob* clone() const = 0;

/// Logger report string formatting for specific job
Q_INVOKABLE virtual QString loggerReport(const QString& status) const = 0;
Q_INVOKABLE virtual QString loggerReport(const QString& status) = 0;

/// Return the QVariant value of this job.
///
Expand All @@ -177,6 +178,16 @@ class CTK_CORE_EXPORT ctkAbstractJob : public QObject
/// \sa ctkJobDetail
Q_INVOKABLE virtual QVariant toVariant();

/// Free used resources from job after worker is done
Q_INVOKABLE virtual void freeUsedResources() = 0;

///@{
/// Destroy job pointer after worker is done
/// default: false
bool destroyAfterUse() const;
void setDestroyAfterUse(bool destroyAfterUse);
///@}

Q_SIGNALS:
void started();
void userStopped();
Expand All @@ -198,6 +209,7 @@ class CTK_CORE_EXPORT ctkAbstractJob : public QObject
QDateTime CompletionDateTime;
QString RunningThreadID;
QString LoggedText;
bool DestroyAfterUse;

private:
Q_DISABLE_COPY(ctkAbstractJob)
Expand Down
45 changes: 45 additions & 0 deletions Libs/Core/ctkCorePythonQtDecorators.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,51 @@ public Q_SLOTS:
{
return td->JobUID;
}
void setCreationDateTime(ctkJobDetail* td, QString creationDateTime)
{
td->CreationDateTime = creationDateTime;
}

QString creationDateTime(ctkJobDetail* td)
{
return td->CreationDateTime;
}

void setStartDateTime(ctkJobDetail* td, QString startDateTime)
{
td->StartDateTime = startDateTime;
}
QString startDateTime(ctkJobDetail* td)
{
return td->StartDateTime;
}

void setCompletionDateTime(ctkJobDetail* td, QString completionDateTime)
{
td->CompletionDateTime = completionDateTime;
}
QString completionDateTime(ctkJobDetail* td)
{
return td->CompletionDateTime;
}

void setRunningThreadID(ctkJobDetail* td, QString runningThreadID)
{
td->RunningThreadID = runningThreadID;
}
QString runningThreadID(ctkJobDetail* td)
{
return td->RunningThreadID;
}

void setLogging(ctkJobDetail* td, QString logging)
{
td->Logging = logging;
}
QString logging(ctkJobDetail* td)
{
return td->Logging;
}
};

//-----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 8afb5c3

Please sign in to comment.