[IMP] possibility to configure values for the estimate-workload configuration
This commit is contained in:
parent
8699d4e8b6
commit
28aee38a81
|
|
@ -7,6 +7,7 @@ postgres_container_name: {{project_name}}-db
|
|||
odoo_host_xmlrpc_port: 9069
|
||||
odoo_default_country_code: FR
|
||||
|
||||
|
||||
odoo_versions:
|
||||
{% for odoo_version in odoo_versions %}
|
||||
- release: {{ odoo_version['release'] }}
|
||||
|
|
@ -19,6 +20,24 @@ migration_steps:
|
|||
action: {{ step['action'] }}
|
||||
complete_name: {{ step['complete_name'] }}
|
||||
{% endfor %}
|
||||
|
||||
workload_settings:
|
||||
|
||||
# porting a module requires 45 minutes minimaly
|
||||
port_minimal_time: 45
|
||||
|
||||
# a migration cost more for each version
|
||||
port_per_version: 15
|
||||
|
||||
# Porting 120 lines of Python code costs 1 hour
|
||||
port_per_python_line_time: 0.5
|
||||
|
||||
# Porting 120 lines of Python code costs 1 hour
|
||||
port_per_javascript_line_time: 0.5
|
||||
|
||||
# Porting 10 lines of XML costs 1 minute
|
||||
port_per_xml_line_time: 0.10
|
||||
|
||||
"""
|
||||
|
||||
REPO_YML_TEMPLATE = """
|
||||
|
|
|
|||
|
|
@ -401,19 +401,6 @@ class OdooModuleVersion(object):
|
|||
|
||||
_file_extensions = [".py", ".xml", ".js"]
|
||||
|
||||
# TODO, make all the values configuration
|
||||
# in the main config.yml file
|
||||
|
||||
# port a module requires 45 minutes minimaly
|
||||
_port_minimal_time = 45
|
||||
# a migration cost more for each version
|
||||
_port_per_version = 15
|
||||
# 1 hour ~ 120 lines of Python / Javascript
|
||||
_port_per_python_line_time = 0.5
|
||||
_port_per_javascript_line_time = 0.5
|
||||
# 1 minute ~ 10 lines of XML
|
||||
_port_per_xml_line_time = 0.10
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
release,
|
||||
|
|
@ -438,6 +425,15 @@ class OdooModuleVersion(object):
|
|||
return [x for x in filter(lambda x: x.addon_path, versions)][-1]
|
||||
|
||||
def estimate_workload(self, ctx):
|
||||
settings = ctx.obj["config"]["workload_settings"]
|
||||
port_minimal_time = settings["port_minimal_time"]
|
||||
port_per_version = settings["port_per_version"]
|
||||
port_per_python_line_time = settings["port_per_python_line_time"]
|
||||
port_per_javascript_line_time = settings[
|
||||
"port_per_javascript_line_time"
|
||||
]
|
||||
port_per_xml_line_time = settings["port_per_xml_line_time"]
|
||||
|
||||
if self.state in ["merged", "renamed", "normal_loss"]:
|
||||
# The module has been moved, nothing to do
|
||||
return
|
||||
|
|
@ -467,20 +463,17 @@ class OdooModuleVersion(object):
|
|||
previous_module_version = self.get_last_existing_version()
|
||||
self.workload = (
|
||||
# Minimal port time
|
||||
self._port_minimal_time
|
||||
port_minimal_time
|
||||
# Add time per release
|
||||
+ (self.release - previous_module_version.release)
|
||||
* self._port_per_version
|
||||
* port_per_version
|
||||
# Add python time
|
||||
+ (
|
||||
self._port_per_python_line_time
|
||||
* previous_module_version.python_code
|
||||
)
|
||||
+ (port_per_python_line_time * previous_module_version.python_code)
|
||||
# Add XML Time
|
||||
+ (self._port_per_xml_line_time * previous_module_version.xml_code)
|
||||
+ (port_per_xml_line_time * previous_module_version.xml_code)
|
||||
# Add Javascript Time
|
||||
+ (
|
||||
self._port_per_javascript_line_time
|
||||
port_per_javascript_line_time
|
||||
* previous_module_version.javascript_code
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ postgres_container_name: test-cli-db
|
|||
odoo_host_xmlrpc_port: 9069
|
||||
odoo_default_country_code: FR
|
||||
|
||||
|
||||
odoo_versions:
|
||||
|
||||
- release: 13.0
|
||||
|
|
@ -30,3 +31,21 @@ migration_steps:
|
|||
release: 14.0
|
||||
action: update
|
||||
complete_name: step_03__update__14.0
|
||||
|
||||
|
||||
workload_settings:
|
||||
|
||||
# porting a module requires 45 minutes minimaly
|
||||
port_minimal_time: 45
|
||||
|
||||
# a migration cost more for each version
|
||||
port_per_version: 15
|
||||
|
||||
# Porting 120 lines of Python code costs 1 hour
|
||||
port_per_python_line_time: 0.5
|
||||
|
||||
# Porting 120 lines of Python code costs 1 hour
|
||||
port_per_javascript_line_time: 0.5
|
||||
|
||||
# Porting 10 lines of XML costs 1 minute
|
||||
port_per_xml_line_time: 0.10
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user