Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future custom annotations #21

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pash_annotations.annotation_generation.annotation_generators.InputOutputInfoGenerator_Interface import InputOutputInfoGeneratorInterface
from pash_annotations.datatypes.BasicDatatypes import Operand


class InputOutputInfoGeneratorGrep(InputOutputInfoGeneratorInterface):

def generate_info(self) -> None:
#no flags case
self.set_implicit_use_of_stdout()
"""
if self.does_flag_option_list_contain_at_least_one_of(["-e", "-f"]):
if self.get_operand_list_length() == 0:
self.set_implicit_use_of_stdin()
else:
self.all_operands_are_streaming_inputs() # this is true also if empty
"""
#else:
self.set_first_operand_as_config_arg_type_string()
if self.get_operand_list_length() == 1:
self.set_implicit_use_of_stdin()
else:
self.all_but_first_operand_is_streaming_input()
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
from pash_annotations.annotation_generation.annotation_generators.ParallelizabilityInfoGenerator_Interface import ParallelizabilityInfoGeneratorInterface
from pash_annotations.annotation_generation.datatypes.parallelizability.Parallelizer import \
AdditionalInfoSplitterToMapper, make_parallelizer_round_robin, make_parallelizer_consec_chunks
from pash_annotations.annotation_generation.datatypes.parallelizability.MapperSpec import make_mapper_spec_custom
from pash_annotations.annotation_generation.datatypes.parallelizability.AggregatorSpec import \
make_aggregator_spec_custom_2_ary_from_string_representation


class ParallelizabilityInfoGeneratorGrep(ParallelizabilityInfoGeneratorInterface):

#base case with grep parallelizability info
def generate_info(self) -> None:
mapper_spec = None
aggregator_spec = None
add_info_from_splitter = None

if (mapper_spec is None or mapper_spec.is_implemented) and \
(aggregator_spec is None or aggregator_spec.is_implemented):
parallelizer_cc = make_parallelizer_consec_chunks(mapper_spec=mapper_spec,
aggregator_spec=aggregator_spec,
info_splitter_mapper=add_info_from_splitter)
self.append_to_parallelizer_list(parallelizer_cc)
parallelizer_rr = make_parallelizer_round_robin(mapper_spec=mapper_spec,
aggregator_spec=aggregator_spec,
info_splitter_mapper=add_info_from_splitter)
self.append_to_parallelizer_list(parallelizer_rr)



""""
from pash_annotations.annotation_generation.annotation_generators.ParallelizabilityInfoGenerator_Interface import ParallelizabilityInfoGeneratorInterface
from pash_annotations.annotation_generation.datatypes.parallelizability.AggregatorSpec import \
make_aggregator_spec_custom_2_ary_from_string_representation
from pash_annotations.annotation_generation.datatypes.parallelizability.MapperSpec import \
make_mapper_spec_custom_from_string_representation
from pash_annotations.annotation_generation.datatypes.parallelizability.Parallelizer import make_parallelizer_round_robin, \
make_parallelizer_consec_chunks
from pash_annotations.annotation_generation.datatypes.parallelizability.Parallelizer import Parallelizer
from pash_annotations.annotation_generation.datatypes.parallelizability.AggregatorSpec import \
make_aggregator_spec_custom_n_ary_from_string_representation

class ParallelizabilityInfoGeneratorCustom(ParallelizabilityInfoGeneratorInterface):
# info to provide: parallelizer_list, round_robin_comp_with_cat, is_commutative (for optimisations)
# parallelizabilityinfo has to-do to remove round_robin_comp_with_cat?

def generate_info(self, parallelizer_list:Parallelizer, round_robin_comp_with_cat:bool, is_commutative:bool, aggregator_spec:str) -> None:
if is_commutative:
self.parallelizability_info.set_commutative()
#mapper spec?
#mapper_spec = make_mapper_spec_custom_from_string_representation("alt_bigrams_aux", is_implemented=True)

if (mapper_spec is None or mapper_spec.is_implemented) and \
(aggregator_spec is None or aggregator_spec.is_implemented):
parallelizer_cc = make_parallelizer_consec_chunks(mapper_spec=mapper_spec,
aggregator_spec=aggregator_spec,
info_splitter_mapper=add_info_from_splitter)
self.append_to_parallelizer_list(parallelizer_cc)
parallelizer_rr = make_parallelizer_round_robin(mapper_spec=mapper_spec,
aggregator_spec=aggregator_spec,
info_splitter_mapper=add_info_from_splitter)
self.append_to_parallelizer_list(parallelizer_rr)
if round_robin_comp_with_cat:
aggregator_spec_custom_rr = make_aggregator_spec_custom_2_ary_from_string_representation(aggregator_spec,
is_implemented=False)
parallelizer_rr = make_parallelizer_round_robin(mapper_spec=None,
aggregator_spec=aggregator_spec_custom_rr,
info_splitter_mapper=None)
self.append_to_parallelizer_list(parallelizer_rr)

#how should the parallelizability info generator handle aggregators, i.e taking in file
agg_spec_custom_cc = make_aggregator_spec_custom_n_ary_from_string_representation(aggregator_spec)
parallelizer_cc = make_parallelizer_consec_chunks(aggregator_spec = agg_spec_custom_cc)
self.parallelizability_info.append_to_parallelizer_list(parallelizer_cc)
"""
Loading