Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Timers manager: Get task time #1896

Merged
merged 10 commits into from
Oct 7, 2021

Conversation

tokejepsen
Copy link
Member

This PR adds a method for querying the task time from all modules registered.

Currently only Ftrack has the method implemented, because I cant find any docs for setting up the Clockify api. This means currently it'll fail when using Clockify.

@tokejepsen tokejepsen added type: enhancement Enhancements to existing functionality module: Ftrack labels Aug 4, 2021
@tokejepsen tokejepsen self-assigned this Aug 4, 2021
@tokejepsen tokejepsen marked this pull request as draft August 4, 2021 09:46
@tokejepsen tokejepsen marked this pull request as ready for review August 30, 2021 13:03
# Conflicts:
#	openpype/modules/default_modules/ftrack/ftrack_module.py
@iLLiCiTiT
Copy link
Member

Do not change avalon-core commit in OpenPype PRs please.

tokejepsen and others added 5 commits September 1, 2021 09:06
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
@tokejepsen
Copy link
Member Author

Do not change avalon-core commit in OpenPype PRs please.

Sorry about that. All fixed now.

Copy link
Member

@iLLiCiTiT iLLiCiTiT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't know I have to commit Review Changes. So 8 days later...

@@ -105,6 +105,15 @@ def start_timer(self, project_name, asset_name, task_name, hierarchy):
}
self.timer_started(None, data)

def get_task_time(self, project_name, asset_name, task_name):
Copy link
Member

@iLLiCiTiT iLLiCiTiT Aug 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If get_task_time method is expected from a module (even if is optional) then should be defined in ITimersManager (inside ~/openpype/modules/default_modules/timers_manager/interfaces.py). Ideally if is optional then return None in default implementation so it is possible to check return value and skip all None values here...

EDITED:
Since PR #2024 timers manager does not have ITimersManager and also does not have attribute modules. Instead of that has _connectors_by_module_id so the loop should look like:

times = {}
for module_id, connector in self._connectors_by_module_id.items():
    if hasattr(connector, "get_task_time"):
        module = self._modules_by_id[module_id]
        times[module.name] = connector.get_task_time(
            project_name, asset_name, task_name
        )
return times

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mkolar
Copy link
Member

mkolar commented Oct 7, 2021

@iLLiCiTiT @tokejepsen could we please resolve the conflict? happy to merge then

# Conflicts:
#	openpype/modules/default_modules/ftrack/ftrack_module.py
@tokejepsen
Copy link
Member Author

@iLLiCiTiT @tokejepsen could we please resolve the conflict? happy to merge then

Done

@mkolar mkolar merged commit d0b2ab7 into ynput:develop Oct 7, 2021
@tokejepsen tokejepsen deleted the feature/timers_manager_get_task_time branch October 7, 2021 17:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
module: Ftrack type: enhancement Enhancements to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants