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

Make CWS multi-contest #594

Closed
wants to merge 5 commits into from
Closed

Make CWS multi-contest #594

wants to merge 5 commits into from

Conversation

wil93
Copy link
Member

@wil93 wil93 commented Mar 26, 2016

With this patch, ContestWebServer does not require a -c flag anymore. When you start CWS, it will expose a list of all available contests on /, and you can click on the contest that you're interested in.

The former cookie behavior was to save 2 cookies: login and unread_count. The new cookie behavior is to save 2*N cookies where N is the number of contests. Each cookie will either be <contest-name>_login or <contest-name>_unread_count.

This PR depends on #545


This change is Reviewable

@wil93 wil93 force-pushed the multi_cws branch 2 times, most recently from 250c7ce to 3989ad8 Compare March 26, 2016 00:32
participation = self.current_user

if not self.r_params["testing_enabled"]:
self.redirect("/")
return
raise tornado.web.HTTPError(403)
Copy link
Member Author

Choose a reason for hiding this comment

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

This change is not needed for the overall patch, but I figured it was a sensible change (which didn't require a different commit or a different PR)

@wil93 wil93 force-pushed the multi_cws branch 3 times, most recently from fee5af7 to c732e40 Compare March 26, 2016 16:08
@wil93 wil93 force-pushed the multi_cws branch 2 times, most recently from 2d01624 to 8d867ab Compare July 4, 2016 14:21
@wil93
Copy link
Member Author

wil93 commented Aug 23, 2016

Seeing that #545 was merged, my faith in this PR was restored and I decided to try and rebase it 😄

It was quite hard (especially because of these commits: cd09d99, 8f0ec9f and 7442fac).

Please let's merge this PR before other commits break it again 🙏


ret["contest"] = self.contest
ret["contest_root"] = ret["url_root"]
ret["real_contest_root"] = "/"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain the semantic of contest_root and real_contest_root?
In some scenarios, this PR causes trouble with StartHandler and LogoutHandler.

Copy link
Member Author

Choose a reason for hiding this comment

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

url_root includes all necessary ../ to go back to the root, so if the URL is localhost:8888/a/b/c then url_root is ../../

real_url_root is always /

contest_root is url_root + the name of the contest, real_contest_root is / + the contest name.

Anyway, I once saw some issues with LogoutHandler, but then I think I fixed them. Do you still see issues?

Copy link
Contributor

Choose a reason for hiding this comment

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

Assume that current URL is localhost:8888/a. Let's start our timer to compete, actually calling StartHandler.
Now that I've understood the meaning, variables are correctly setted as:

  • url_root = ..
  • contest_root = ../a
  • real_contest_root = /a

StartHandler tries to redirect the user to ../a (see https://github.com/wil93/cms/blob/multi_cws/cms/server/contest/handlers/main.py#L148)
but our custom redirector (see https://github.com/wil93/cms/blob/multi_cws/cms/server/util.py#L714) creates the invalid URL localhost:8888/a/..../a

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought I had fixed that, but it seems this bug is still on the multi_cws branch 😕

I think I fixed it in PR #646 (which is based on this one). I'll backport the fixes here 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thanks 😄 it looks like I had fixed this in the wrong branch (and just for LogoutHandler, thus leaving a broken StartHandler)

Copy link
Contributor

Choose a reason for hiding this comment

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

Everything works as expected now ;)

@andreyv
Copy link
Member

andreyv commented Dec 11, 2016

With this branch I don't see a language selection option in CWS. Can you reproduce this?

@wil93
Copy link
Member Author

wil93 commented Dec 11, 2016

@andreyv Yes, I had noticed that some time ago but didn't investigate. I tried to fix it now, it should work

@karliss karliss mentioned this pull request Dec 19, 2016
@wil93
Copy link
Member Author

wil93 commented Mar 20, 2017

65311258

@stefano-maggiolo
Copy link
Member

I rebased this PR to master - it was great fun, but I suggest we don't do it again and try to close it asap, by commenting here and fixing up in my branch (once done commenting, I can publish my branch to let you try it out, if you want)

Unless you have better ideas, that is...

Looking again at the code now.

@wil93
Copy link
Member Author

wil93 commented Mar 27, 2017

try to close it asap, by commenting here and fixing up in my branch

I'm not sure I understand what's the plan 😅

@@ -83,15 +84,25 @@ def __init__(self, shard, contest):
"contest_listen_address and contest_listen_port "
"in cms.conf." % __name__)

self.contest = contest
del contest
Copy link
Member

Choose a reason for hiding this comment

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

Why are you deleting a local variable?

@lw
Copy link
Member

lw commented Mar 28, 2017

How does this work when CWS is managed by RS? From what I see I understand that CWS will always be started in single-contest mode. Is that correct?

@wil93
Copy link
Member Author

wil93 commented Mar 28, 2017 via email

@lw
Copy link
Member

lw commented Mar 28, 2017

You didn't understand my question. I wasn't talking about how to launch CWS from the command line. I was in some sense saying that it appears to me that it's impossible to launch CWS in multi-contest mode when RS is used to manage it. Am I wrong?

Also, AFAIK, we don't do that, we don't remove local variables.

@stefano-maggiolo
Copy link
Member

@lerks I don't see it as a problem for the first submitted version of this code.

@wil93 I wanted to comment here, but my work is done mostly when I don't have internet connection and reviewable doesn't make it easy - how about I jot down a first fixup commit with straightforward stuff, send a PR with these commits and my fixups, and we can continue the discussion there?

@wil93
Copy link
Member Author

wil93 commented Mar 28, 2017 via email

@stefano-maggiolo
Copy link
Member

See #739

@stefano-maggiolo
Copy link
Member

Damn, just a tad out of our service level agreement of one year ;P

Merged!

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

Successfully merging this pull request may close these issues.

5 participants