Skip to content

Instantly share code, notes, and snippets.

import torch
import torch.nn as nn
import torchvision.transforms.functional as F
import numpy as np
class HED(nn.Module):
""" HED network. """
def __init__(self):
super(HED, self).__init__()
@normster
normster / wnids_to_class_idx.txt
Created September 5, 2019 19:07
imagenet2012 wnid to class indices
n01440764 0
n01443537 1
n01484850 2
n01491361 3
n01494475 4
n01496331 5
n01498041 6
n01514668 7
n01514859 8
n01518878 9
@normster
normster / dataset_info.json
Created August 5, 2019 00:20
Dataset info object for Cifar10Corrupted
{
"citation": "@inproceedings{\n hendrycks2018benchmarking,\n title={Benchmarking Neural Network Robustness to Common Corruptions and Perturbations},\n author={Dan Hendrycks and Thomas Dietterich},\n booktitle={International Conference on Learning Representations},\n year={2019},\n url={https://openreview.net/forum?id=HJz6tiCqYm},\n}\n",
"description": "Cifar10Corrupted is a dataset generated by adding 15 common corruptions + 4\nextra corruptions to the test images in the Cifar10 dataset. This dataset wraps\nthe corrupted Cifar10 test images uploaded by the original authors.\n",
"location": {
"urls": [
"https://github.com/hendrycks/robustness"
]
},
"name": "cifar10_corrupted",
"schema": {
import time
from flask import Flask, request, g, render_template
import pymongo
import os
conn_str = os.environ['MONGOCONN']
client = pymongo.MongoClient(conn_str)
db = client.growls
app = Flask(__name__)
[2016-08-03 15:03:07,045] {_internal.py:87} INFO - 127.0.0.1 - - [03/Aug/2016 15:03:07] "POST /admin/dagrun/new/?url=%2Fadmin%2Fdagrun%2F HTTP/1.1" 500 -
Traceback (most recent call last):
File "/Users/norman/src/incubator-airflow/venv/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/norman/src/incubator-airflow/venv/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/norman/src/incubator-airflow/venv/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/norman/src/incubator-airflow/venv/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
The feature I am trying to add is a “Dag Stats” column to the main admin view that shows the status of every single run of a dag (running, failed, success). I renamed the current Dag Stats column to Task Stats, which more accurately reflects its information.
I originally accomplished this through a single database query against the dagrun table every time the page is loaded, but Sid pointed out that this would perform incredibly bad for any user with a large number of dags or dag runs.
I’m currently using another table called DagStats that stores dag stat data that can be pulled and immediately displayed by the Dag Stats column, and updating the DagStats table whenever a dagrun’s state changes and causes some rows of the DagStats table to become out of date.
There are two static methods in the DagStat class in models-- set_dirty() and clean_dirty(). Set_dirty() takes one argument, the ID of a dag. It then sets the dirty bit of all rows with that Dag ID to true to indicate these rows are out of date. Clean

Keybase proof

I hereby claim:

  • I am normster on github.
  • I am normster (https://keybase.io/normster) on keybase.
  • I have a public key whose fingerprint is CCDD 9AAC 2F02 0DD7 7265 2A45 EEC6 0896 B76A C08D

To claim this, I am signing this object: