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

rizza is now using the field type to create an #29

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tstrych
Copy link

@tstrych tstrych commented Aug 26, 2022

this is a draft
Please read the comments and todo's.

I search for all usages in nailgun entities file and all of them are created mainly just by the simple fauxfactory method.
With this knowledge, I map field type to fauxfactory method, so it can be created.
There are still some waiting for implementation, but this is the first step.

Also. I disabled OneToOneField and OneToManyFields in case there are no dependencies allowed.

These changes gradually improve the speed of search.

@JacobCallahan JacobCallahan marked this pull request as draft August 26, 2022 13:51
self.base_dir = Path.home().joinpath('rizza')
self.base_dir = Path(os.getcwd())
Copy link
Owner

Choose a reason for hiding this comment

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

Rizza is meant to operate out of a user's home directory, not current directory

Copy link
Author

Choose a reason for hiding this comment

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

I did this just to set up my project. With this upgrade, it worked for me outside the home's directory.

'MACAddressField': 'gen_mac',
'NetmaskField': 'gen_netmask',
'StringField': 'gen_string',
'URLField': 'gen_url',
Copy link
Owner

Choose a reason for hiding this comment

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

mapping fields like this may stepping over the line that is providing too much help to Rizza instead of letting Rizza figure things out with experimentation

Copy link
Author

Choose a reason for hiding this comment

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

I disagree, because what we want to achieve in first step is fast genetic programming, is always easier to make it more complex without a hints.

A) Now we are talking about 15 different types, 2 are using other entities, 2 are more complex types lst and dict.
And now they are exactly match. So complexity is only in choosing the right fields and arguments, not matching the types instead.

B) In your previous solution you used 37 types,
list(entity_tester.EntityTester.pull_input_methods() without float list and dict which are actually used in the nailgun.
so each field and attribute has to firstly guess the type which is complexity of number_of_fields^field_types + number_of_args^field. And we didn't even start to match the fields and arguments required for the entities.

A broader search of space in option B can found results in BZ creation, but it would take forever. You might run it separately, but anyway you firstly need a way to look at the answer and say okay this is fine/wrong. Doing it manually might be overkill.

@@ -34,6 +34,7 @@ def _breed_pair(self, gene_list1, gene_list2):
Random mutation is then given a chance to change the child.

"""
# TODO now with nested lists and dict this requires rework
Copy link
Author

Choose a reason for hiding this comment

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

this is now the bottleneck which requires additional work. As mutation in some cases does not work the program will fail, but it shouldn't be a lot of work to fix it.

self.config
))
return lst
# TODO dict
Copy link
Author

Choose a reason for hiding this comment

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

the same needs to be done for dict,
and of course dict of lists and lists of dict.

self.load_config()
self.RIZZA['CONFILE'] = self.cfg_file
Copy link
Author

Choose a reason for hiding this comment

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

I also played a bit with clean config config rizza --clear, to reload environment vars into the conf file and therefore to code.

# we want to always use current directory as base for tests
if 'tests' in str(self.cfg_file):
self.cfg_file = Path().joinpath(self.cfg_file)
elif self.cfg_file != str(Path(self.cfg_file).absolute()):
self.cfg_file = self.base_dir.joinpath(self.cfg_file)
self.RIZZA['CONFILE'] = self.cfg_file
self.cfg_file = str(self.base_dir.joinpath(self.cfg_file))
Copy link
Author

Choose a reason for hiding this comment

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

it wrote !!python-bla-bla-bla into the configuration file so it was required to retype to string

@tstrych
Copy link
Author

tstrych commented Aug 31, 2022

I believe that it is successfull attempt, just not finished

[I 220831 12:10:18 genetic_tester:258] Success! Generation 0 passed with:
    arg_dict:
      ignore: gen_string
    entity: Capsule
    field_dict:
      id: gen_string
      name: gen_integer
    method: read

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants