88# the Free Software Foundation, either version 3 of the License, or
99# (at your option) any later version.
1010
11- import json
1211import pathlib
13-
1412from logging import Logger
15- from typing import Dict , Optional , Set
16-
17- from wfcommons .wfgen . abstract_recipe import WorkflowRecipe
13+ from typing import Optional , Set
14+ import pathlib
15+ from wfcommons .wfchef . wfchef_abstract_recipe import BaseMethod , WfChefWorkflowRecipe
1816
1917this_dir = pathlib .Path (__file__ ).resolve ().parent
2018
2119
22- class CyclesRecipe (WorkflowRecipe ):
20+ class CyclesRecipe (WfChefWorkflowRecipe ):
2321 """A Cycles workflow recipe class for creating synthetic workflow instances.
2422
2523 :param data_footprint: The upper bound for the workflow total data footprint (in bytes).
@@ -46,47 +44,18 @@ def __init__(self,
4644 input_file_size_factor : Optional [float ] = 1.0 ,
4745 output_file_size_factor : Optional [float ] = 1.0 ,
4846 logger : Optional [Logger ] = None ,
47+ base_method : BaseMethod = BaseMethod .ERROR_TABLE ,
4948 ** kwargs ) -> None :
50- super ().__init__ ("Cycles" , data_footprint , num_tasks , exclude_graphs , runtime_factor , input_file_size_factor ,
51- output_file_size_factor , logger , this_dir )
52-
53- @classmethod
54- def from_num_tasks (cls ,
55- num_tasks : int ,
56- exclude_graphs : Set [str ] = set (),
57- runtime_factor : Optional [float ] = 1.0 ,
58- input_file_size_factor : Optional [float ] = 1.0 ,
59- output_file_size_factor : Optional [float ] = 1.0
60- ) -> 'CyclesRecipe' :
61- """
62- Instantiate a Cycles workflow recipe that will generate synthetic workflows up to
63- the total number of tasks provided.
64-
65- :param num_tasks: The upper bound for the total number of tasks in the workflow (at least 3).
66- :type num_tasks: int
67- :param exclude_graphs:
68- :type exclude_graphs: Set
69- :param runtime_factor: The factor of which tasks runtime will be increased/decreased.
70- :type runtime_factor: float
71- :param input_file_size_factor: The factor of which tasks input files size will be increased/decreased.
72- :type input_file_size_factor: float
73- :param output_file_size_factor: The factor of which tasks output files size will be increased/decreased.
74- :type output_file_size_factor: float
75-
76- :return: A Cycles workflow recipe object that will generate synthetic workflows up
77- to the total number of tasks provided.
78- :rtype: CyclesRecipe
79- """
80- return CyclesRecipe (num_tasks = num_tasks , exclude_graphs = exclude_graphs , runtime_factor = runtime_factor ,
81- input_file_size_factor = input_file_size_factor ,
82- output_file_size_factor = output_file_size_factor )
83-
84- def _workflow_recipe (self ) -> Dict :
85- """
86- Recipe for generating synthetic instances of the Cycles workflow. Recipes can be
87- generated by using the :class:`~wfcommons.wfinstances.instance_analyzer.InstanceAnalyzer`.
88-
89- :return: A recipe in the form of a dictionary in which keys are task prefixes.
90- :rtype: Dict[str, Any]
91- """
92- return json .loads (this_dir .joinpath ("task_type_stats.json" ).read_text ())
49+ super ().__init__ (
50+ name = "Cycles" ,
51+ data_footprint = data_footprint ,
52+ num_tasks = num_tasks ,
53+ exclude_graphs = exclude_graphs ,
54+ runtime_factor = runtime_factor ,
55+ input_file_size_factor = input_file_size_factor ,
56+ output_file_size_factor = output_file_size_factor ,
57+ logger = logger ,
58+ this_dir = this_dir ,
59+ base_method = base_method ,
60+ ** kwargs
61+ )
0 commit comments