From 32eb1bc27d8e6b4f70de4df2ee5d763ea097a010 Mon Sep 17 00:00:00 2001 From: Francisco Ribeiro Date: Wed, 9 May 2018 04:45:08 +0100 Subject: [PATCH 01/38] added task broadcasting for workers within a group --- gluon/scheduler.py | 60 +++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/gluon/scheduler.py b/gluon/scheduler.py index 79d22c0f..05567592 100644 --- a/gluon/scheduler.py +++ b/gluon/scheduler.py @@ -804,6 +804,7 @@ class Scheduler(MetaScheduler): Field('group_name', default='main'), Field('status', requires=IS_IN_SET(TASK_STATUS), default=QUEUED, writable=False), + Field('broadcast', 'boolean', default=False), Field('function_name', requires=IS_IN_SET(sorted(self.tasks.keys())) if self.tasks else DEFAULT), @@ -1358,23 +1359,48 @@ class Scheduler(MetaScheduler): gname = task.group_name ws = wkgroups.get(gname) if ws: - counter = 0 - myw = 0 - for i, w in enumerate(ws['workers']): - if w['c'] < counter: - myw = i - counter = w['c'] - assigned_wn = wkgroups[gname]['workers'][myw]['name'] - d = dict( - status=ASSIGNED, - assigned_worker_name=assigned_wn - ) - db( - (st.id == task.id) & - (st.status.belongs((QUEUED, ASSIGNED))) - ).update(**d) - wkgroups[gname]['workers'][myw]['c'] += 1 - db.commit() + if task.broadcast: + for worker in ws['workers']: + new_task = db.scheduler_task.insert( + application_name = task.application_name, + task_name = task.task_name, + group_name = task.group_name, + status = ASSIGNED, + broadcast = False, + function_name = task.function_name, + args = task.args, + start_time = now, + repeats = 1, + retry_failed = task.retry_failed, + sync_output = task.sync_output, + assigned_worker_name = worker['name']) + if task.period: + next_run_time = now+datetime.timedelta(seconds=task.period) + else: + # must be cronline + raise NotImplementedError + db(st.id == task.id).update(times_run=task.times_run+1, + next_run_time=next_run_time, + last_run_time=now) + db.commit() + else: + counter = 0 + myw = 0 + for i, w in enumerate(ws['workers']): + if w['c'] < counter: + myw = i + counter = w['c'] + assigned_wn = wkgroups[gname]['workers'][myw]['name'] + d = dict( + status=ASSIGNED, + assigned_worker_name=assigned_wn + ) + db( + (st.id == task.id) & + (st.status.belongs((QUEUED, ASSIGNED))) + ).update(**d) + wkgroups[gname]['workers'][myw]['c'] += 1 + db.commit() # I didn't report tasks but I'm working nonetheless!!!! if x > 0: self.w_stats.empty_runs = 0 From 7111b3dcb2afb526f9c7000fc36737e09b8f4968 Mon Sep 17 00:00:00 2001 From: Nico Zanferrari Date: Wed, 8 Aug 2018 00:13:23 +0200 Subject: [PATCH 02/38] Python 3 compatibility clarification --- applications/examples/views/default/download.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/applications/examples/views/default/download.html b/applications/examples/views/default/download.html index c1ecdec5..d8df3871 100644 --- a/applications/examples/views/default/download.html +++ b/applications/examples/views/default/download.html @@ -62,16 +62,16 @@

- The source code version works on all supported platforms, including Linux, but it requires Python 2.6, or 2.7 (recommended). - It runs on Windows and most Unix systems, including Linux and BSD. + The source code version works on Windows and most Unix systems, including Linux, BSD and Mac . It requires Python 2.6 (no more supported), Python 2.7 (stable) or Python 3.5+ (recommended for new projects) already installed on your system. + There are also binary packages for Windows and Mac OS X. They include the Python 2.7 interpreter so you do not need to have it pre-installed.

Instructions

-

After download, unzip it and click on web2py.exe (windows) or web2py.app (osx). - To run from source, type:

-{{=CODE("python2.7 web2py.py", language=None, counter='>', _class='boxCode')}} +

With the binary packages, after download, just unzip it and then click on web2py.exe (windows) or web2py.app (osx). + If you prefer to run it from source with your own Python interpreter alreay installed, type:

+{{=CODE("python web2py.py", language=None, counter='>', _class='boxCode')}}

or for more info type:

-{{=CODE("python2.7 web2py.py -h", language=None, counter='>', _class='boxCode')}} +{{=CODE("python web2py.py -h", language=None, counter='>', _class='boxCode')}}

Caveats

From 46b8ad3fddfa6108ac4bec9d88d8c2088d324cd3 Mon Sep 17 00:00:00 2001 From: Kelvin Spencer Date: Wed, 8 Aug 2018 08:58:15 -0500 Subject: [PATCH 03/38] Update web2py_bootstrap.js This allows dropdown menu items to be open in the target specified if it exists without changing main/top window --- applications/admin/static/js/web2py_bootstrap.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/applications/admin/static/js/web2py_bootstrap.js b/applications/admin/static/js/web2py_bootstrap.js index 7206cb1b..abf6d1c7 100644 --- a/applications/admin/static/js/web2py_bootstrap.js +++ b/applications/admin/static/js/web2py_bootstrap.js @@ -29,5 +29,14 @@ jQuery(function(){ } hoverMenu(); // first page load jQuery(window).resize(hoverMenu); // on resize event - jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');}); + jQuery('ul.nav li.dropdown a').click(function(){ + if(jQuery(this).attr("target")){ + window.open( + jQuery(this).attr('href'), + jQuery(this).attr('target') // <- This is what makes it open in a new window. + ); + } else { + window.location=jQuery(this).attr('href'); + } + }); }); From 63972386c23961360d99c5ce49240b0aed5c820f Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 12 Aug 2018 10:56:58 -0700 Subject: [PATCH 04/38] fixed limitby in sqlhtml grid, thanks Paolo --- gluon/sqlhtml.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 028cafd9..f32dc864 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -699,18 +699,20 @@ class AutocompleteWidget(object): if isinstance(field, Field.Virtual): records = [] table_rows = self.db(self.db[field.tablename]).select(orderby=self.orderby) - count = 0 + count = self.limitby[1] if self.limitby else -1 for row in table_rows: if self.at_beginning: if row[field.name].lower().startswith(kword): - count += 1 + count -= 1 records.append(row) else: if kword in row[field.name].lower(): - count += 1 + count -= 1 records.append(row) - if count == 10: + if count == 0: break + if self.limitby and self.limitby[0]: + records = records[self.limitby[0]:] rows = Rows(self.db, records, table_rows.colnames, compact=table_rows.compact) elif settings and settings.global_settings.web2py_runtime_gae: @@ -1090,7 +1092,7 @@ def formstyle_bootstrap3_inline_factory(col_label_size=3): # bootstrap 4 def formstyle_bootstrap4_stacked(form, fields): - """ bootstrap 3 format form layout + """ bootstrap 4 format form layout Note: Experimental! @@ -1139,7 +1141,7 @@ def formstyle_bootstrap4_stacked(form, fields): def formstyle_bootstrap4_inline_factory(col_label_size=3): - """ bootstrap 3 horizontal form layout + """ bootstrap 4 horizontal form layout Note: Experimental! @@ -2855,9 +2857,9 @@ class SQLFORM(FORM): if paginate and dbset._db._adapter.dbengine == 'google:datastore' and use_cursor: cursor = request.vars.cursor or True limitby = (0, paginate) - page = safe_int(request.vars.page, 1) - 1 + page = safe_int(request.vars.page or 1, 1) - 1 elif paginate and paginate < nrows: - page = safe_int(request.vars.page, 1) - 1 + page = safe_int(request.vars.page or 1, 1) - 1 limitby = (paginate * page, paginate * (page + 1)) else: limitby = None @@ -2899,7 +2901,7 @@ class SQLFORM(FORM): paginator = UL() if paginate and dbset._db._adapter.dbengine == 'google:datastore' and use_cursor: # this means we may have a large table with an unknown number of rows. - page = safe_int(request.vars.page, 1) - 1 + page = safe_int(request.vars.page or 1, 1) - 1 paginator.append(LI('page %s' % (page + 1))) if next_cursor: d = dict(page=page + 2, cursor=next_cursor) @@ -2918,7 +2920,7 @@ class SQLFORM(FORM): npages, reminder = divmod(nrows, paginate) if reminder: npages += 1 - page = safe_int(request.vars.page, 1) - 1 + page = safe_int(request.vars.page or 1, 1) - 1 def self_link(name, p): d = dict(page=p + 1) From e7fee6a4172f3e42cb12322408ec594986e34a59 Mon Sep 17 00:00:00 2001 From: Erik Montes Date: Mon, 13 Aug 2018 23:34:22 -0700 Subject: [PATCH 05/38] Create bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..b7353733 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,35 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. From 6b8ccff2a436cb7e30303bd8420c475aa4dfa72f Mon Sep 17 00:00:00 2001 From: Erik Montes Date: Mon, 13 Aug 2018 23:36:16 -0700 Subject: [PATCH 06/38] Create feature_request.md --- .github/ISSUE_TEMPLATE/feature_request.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..066b2d92 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From 4f29733fae1d33f233ab97107c7b704992be8c46 Mon Sep 17 00:00:00 2001 From: Nico Zanferrari Date: Thu, 16 Aug 2018 18:31:13 +0200 Subject: [PATCH 07/38] restore dark navbar --- applications/welcome/views/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/welcome/views/layout.html b/applications/welcome/views/layout.html index 5643dfdf..d26d052e 100644 --- a/applications/welcome/views/layout.html +++ b/applications/welcome/views/layout.html @@ -35,7 +35,7 @@
{{=response.flash or ''}}
-