60fd6764c1b29d88b2b8b33fbc5d1f1c1dc9d344,python/xpctl/sql/backend.py,SQLRepo,put_model,#SQLRepo#Any#Any#Any#Any#Any#,161

Before Change


    def put_model(self, id, task, checkpoint_base, checkpoint_store, print_fn=print):
        coll = self.db[task]
        query = {"_id": ObjectId(id)}
        projection = {"sha1": 1}
        results = list(coll.find(query, projection))
        if not results:
            print_fn("no sha1 for the given id found, returning.")
            return False
        sha1 = results[0]["sha1"]
        model_loc = store_model(checkpoint_base, sha1, checkpoint_store, print_fn)
        if model_loc is not None:
            coll.update_one({"_id": ObjectId(id)}, {"$set": {"checkpoint": model_loc}}, upsert=False)
        return model_loc

After Change


        return set([t[0] for t in session.query(Experiment.task).distinct()])

    def put_model(self, id, task, checkpoint_base, checkpoint_store, print_fn=print):
        session = self.Session()
        exp = session.query(Experiment).get(id)
        if exp is None:
            print_fn("no sha1 for the given id found, returning.")
            return None
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: dpressel/mead-baseline
Commit Name: 60fd6764c1b29d88b2b8b33fbc5d1f1c1dc9d344
Time: 2018-09-19
Author: sagnik1987@gmail.com
File Name: python/xpctl/sql/backend.py
Class Name: SQLRepo
Method Name: put_model


Project Name: tensorflow/minigo
Commit Name: 39a106e526e70b5d64bf9f5404311eb490df6ea5
Time: 2018-06-12
Author: tmadams@google.com
File Name: inference_worker.py
Class Name:
Method Name: main


Project Name: quiltdata/quilt
Commit Name: 9087a7f9301e17510bc903b9beb532bc7ae641fd
Time: 2020-07-16
Author: dima@quiltdata.io
File Name: lambdas/access_counts/index.py
Class Name:
Method Name: handler