9e9c9c7510b6b50c221cefdde9d30c3b058a2620,server/website/website/models.py,SessionKnobManager,get_knobs_for_session,#Any#,185

Before Change


        knobs = KnobCatalog.objects.filter(dbms=session.dbms)
        knob_dicts = list(knobs.values())
        for i, _ in enumerate(knob_dicts):
            if SessionKnob.objects.filter(session=session, knob=knobs[i]).exists():
                new_knob = SessionKnob.objects.filter(session=session, knob=knobs[i])[0]
                knob_dicts[i]["minval"] = new_knob.minval
                knob_dicts[i]["maxval"] = new_knob.maxval
                knob_dicts[i]["tunable"] = new_knob.tunable
        knob_dicts = [knob for knob in knob_dicts if knob["tunable"]]
        return knob_dicts

    @staticmethod

After Change


        session_knobs = SessionKnob.objects.filter(
            session=session, tunable=True).prefetch_related("knob")
        session_knobs = {s.knob.pk: s for s in session_knobs}
        knob_dicts = list(KnobCatalog.objects.filter(id__in=session_knobs.keys()).values())
        for knob_dict in knob_dicts:
            sess_knob = session_knobs[knob_dict["id"]]
            knob_dict["minval"] = sess_knob.minval
            knob_dict["maxval"] = sess_knob.maxval
            knob_dict["tunable"] = sess_knob.tunable
        return knob_dicts

    @staticmethod
    def get_knob_min_max_tunability(session, tunable_only=False):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: cmu-db/ottertune
Commit Name: 9e9c9c7510b6b50c221cefdde9d30c3b058a2620
Time: 2019-12-05
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/models.py
Class Name: SessionKnobManager
Method Name: get_knobs_for_session


Project Name: pantsbuild/pants
Commit Name: f652b7ca5dee09e6331187551019921e9c1a6f11
Time: 2013-11-25
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/tasks/scala_compile.py
Class Name: ScalaCompile
Method Name: execute


Project Name: deepfakes/faceswap
Commit Name: 309470af087c64cb91de6ec6decbd50f43becf90
Time: 2018-03-10
Author: hyyrynen.lasse@gmail.com
File Name: lib/cli.py
Class Name: DirectoryProcessor
Method Name: load_filter