GSoC’21 — Week 7 and 8 — Setting up the reply functionality

Well, I know I am late, but the last 2 weeks were super hectic because of my University examinations. The examination board suddenly decided to give out grades on the basis of internal examinations and I was burdened with projects, presentations, assignments, and vivas. I did manage to set up a base for the replying functionality. Here are some of the major things I added to the bot -

Refactored random part of the codebase

The codebase was very messy in the parts where random configurations were being generated for the bot and refactoring it solved 2 issues together. One, the code quality improved by a lot, and two, now that the randomness was separated from the functions that created simulations, it became very easy to pass down configurations into these functions which in turn paved the way for integrating the functionality into the existing codebase. The function was also converted to a class named to split up the comparisons into 2 parts — (comparing 2 or more models with an experiment or with a constant discharge) and (comparing a single model but varying a specific parameter).

Infinite reply issue

The recent deployment was working well but the bot was replying to the tweets every time the scheduled workflows ran. The replying feature worked on the following logic —

  1. Read all the tweets in which the bot is mentioned ID > stored ID.
  2. Store the tweet’s ID in a text file.
  3. Iterate over these tweets and reply.
  4. Repeat 1–3

This does create a chicken-egg problem for the bot with the tweet IDs, hence the first tweet ID was manually stored in the text file. All of this was happening on , i.e. the text file on GitHub was not updated with every new mention.

Now coming to the bug, we had enabled automatic deployment on which meant that every time the passed on the branch (which happened on every scheduled run), the bot was continuously deployed on where it was built again with the outdated text file (that had the tweet ID) and the bot started reading and replying to tweets from that old ID.

To tackle this, a new function was added to sync the tweet IDs stored in and in .

The CI is failing currently due to some issues, but again, it is very hard to test it on a PR as most of it won’t even run on a PR. It will be fixed probably by tomorrow and the first simulation request will be out by this weekend!

Always learning