Demonstration of a task which runs a startup task, then parallelizes multiple worker tasks, and then fires-off a reducer task.
If passing results around would be important, then could use a chord instead for task2 and task3.
| ' Example function call: =BuildHTMLTable(A1:D5) | |
| Public Function BuildHTMLTable(rng As Range) As String | |
| ' Given a Range of Cells, build a Bootstrap HTML table, using the formatting | |
| ' specified in the Excel cells. If "header" is specified to equal true, assumes | |
| ' the first row in the table is a header row. | |
| Dim last_r As Long: last_r = rng.Cells(1, 1).Row | |
| Dim tds As New Collection | |
| Dim txt As String | |
| Dim isFirstRow As Boolean: isFirstRow = True |
| #usr/bin/python | |
| import os | |
| import re | |
| this_path = os.path.abspath(__file__) | |
| static_path = os.path.abspath(os.path.join(this_path, r'../../project/static')) | |
| import smtplib | |
| def send_email(email, pw, subject, text): | |
| FROM = email | |
| TO = [email] | |
| try: | |
| message = """\From: %s\nTo: %s\nSubject: %s\n\n%s\n""" % (FROM, ", ".join(TO), subject, text) | |
| server = smtplib.SMTP("smtp.gmail.com", 587) # alternatively port 465 | |
| server.ehlo() |
| from datetime import datetime, timedelta | |
| import os | |
| def renameByDatestamp(path, hourAdjustment): | |
| """ | |
| Rename files in a path using the time-created stamp. Adjust name by adding | |
| an integer if files have non-unique timestamps. | |
| Ideal for renaming pictures and videos from multiple sources. |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| <style id="jsbin-css"> | |
| output { | |
| position: absolute; | |
| background-image: linear-gradient(#444444, #999999); |
Demonstration of a task which runs a startup task, then parallelizes multiple worker tasks, and then fires-off a reducer task.
If passing results around would be important, then could use a chord instead for task2 and task3.
Globally add pre-commit hooks on all user's computers. Use prettier to automatically clean JS/CSS code, and throw errors for python code which doesn't meet flake8 rules.
One problem is flake8 needs to be available in the pre-commit path, which without adding globally I struggled with...
Testing that state isn't shared between two Rserve connections using pyRserve:
>>> import pyRserve
>>> conn1 = pyRserve.connect(host='localhost', port=6311)
>>> conn2 = pyRserve.connect(host='localhost', port=6311)
>>> conn1.eval('x<-function(n){n**2}')
>>> conn1.r.x(2)
4.0
>>> conn2.r.x(2)| # an example job submission | |
| curl \ | |
| -X POST \ | |
| -H "Authorization: Token abcdefghijklmnopqrstuvwxyz1234567890" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"jobtype": "success", "name": "Isaac Newton"}' \ | |
| https://sandbox.ntp.niehs.nih.gov/job-runner/api/v1/test/ | |
| # an example request to check results of job | |
| curl \ |
| from datetime import datetime | |
| import logging | |
| import sys | |
| import time | |
| import click | |
| import boto3 | |
| logging.basicConfig(stream=sys.stdout, level=logging.INFO) |