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

Write run config from ui #261

Merged
merged 76 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
50b5f0f
WIP UI pipeline config
srggrs Jul 23, 2020
5d633f7
add bootstrap-select package
srggrs Jul 26, 2020
5e5cda9
add raw image default path to settings
srggrs Jul 27, 2020
3245c9f
add list raw fit and selavy files api
srggrs Jul 27, 2020
d1a79cf
pipeline run config from UI, select files
srggrs Jul 27, 2020
5e8e03e
add cloudpickle
srggrs Jul 27, 2020
ac46eea
fix indentation add disable menu based on monitor
srggrs Jul 28, 2020
c02957a
simplified jquery, add monitor config form fields
srggrs Jul 28, 2020
9194587
completed and styled run config form
srggrs Jul 28, 2020
347c865
add run details in form, add show and hide config
srggrs Jul 29, 2020
0242b43
removed comment line
srggrs Jul 29, 2020
0f4fe7c
removed data select limit
srggrs Jul 29, 2020
5bcd1b0
add selectpicker title and data tokens attribute
srggrs Jul 30, 2020
07fa1a7
added reset form button
srggrs Jul 31, 2020
6cea9c7
add passing config values from django settings
srggrs Jul 31, 2020
0641782
add pipeline run name validation
srggrs Aug 2, 2020
3855e85
update initpiperun with refactor, errors
srggrs Aug 2, 2020
e91119f
remove commented line, change alert position
srggrs Aug 4, 2020
0968692
update with passing config dict
srggrs Aug 4, 2020
11d0cd7
add form names, change to diabled to readonly
srggrs Aug 4, 2020
a62dc87
change interval to 5 seconds
srggrs Aug 4, 2020
55d8889
added run creation backend part
srggrs Aug 4, 2020
9f3660d
Merge branch 'master' into write-run-config-from-ui
srggrs Aug 4, 2020
81f377a
Merge branch 'master' into write-run-config-from-ui
srggrs Aug 4, 2020
906ccd2
add user relationship to pipeline run
srggrs Aug 4, 2020
a11eaff
fix run detail view, fix error/user run creation
srggrs Aug 4, 2020
c505e9b
added view config file in run detail
srggrs Aug 4, 2020
b50e610
fix writing list of strings in template
srggrs Aug 4, 2020
d0ba8fe
add deruiter, set readonly depending on deruiter
srggrs Aug 6, 2020
210c594
added sorting list of paths
srggrs Aug 6, 2020
797d5eb
add count in selection
srggrs Aug 6, 2020
42b4e2b
added log card in run detail page
srggrs Aug 6, 2020
bb4cbbc
fix run model user fk with blank=true
srggrs Aug 6, 2020
e9dd049
fix user in run detail view
srggrs Aug 6, 2020
df59007
fix set status function
srggrs Aug 6, 2020
644e56e
move transaction.atomic line when needed
srggrs Aug 6, 2020
c8790e5
added checks for raw image folder and files lists
srggrs Aug 6, 2020
5997d08
removed cutting base path, loop for getting paths
srggrs Aug 6, 2020
2496867
changed delay to 10 seconds
srggrs Aug 6, 2020
a4b3b4f
add catch error in reading forced meas parquets
srggrs Aug 6, 2020
6ff99cb
add config dropdown menu for actions
srggrs Aug 6, 2020
5ad3ed1
better message for no pipeline run user
srggrs Aug 6, 2020
abce300
fix title log file card
srggrs Aug 6, 2020
5229dbf
another variant of the run detail page
srggrs Aug 6, 2020
066a094
add view to validate pipeline run config
srggrs Aug 6, 2020
9d0ef59
added url link to validate view
srggrs Aug 6, 2020
8fd8257
finilise up cards layout run detail page
srggrs Aug 7, 2020
609f07c
Merge branch 'run-detail-page-another-variant' into write-run-config-…
srggrs Aug 7, 2020
8ecc2e3
added survey field to form, change invalid to readonly
srggrs Aug 7, 2020
0292377
added traceback, pipeline assignment inside try
srggrs Aug 7, 2020
b73c1fa
added validation popup, better api messages
srggrs Aug 7, 2020
4e6762d
fix os separator, add (jupyter-)user home if exists
srggrs Aug 7, 2020
c648908
added write config functionality
srggrs Aug 7, 2020
7b6a208
add prismjs task, add config py syntax formatting
srggrs Aug 8, 2020
600fe7b
First tool tips
ajstewart Aug 10, 2020
1346825
fix error init method
srggrs Aug 10, 2020
4de1151
Fixed hyphen regex
ajstewart Aug 10, 2020
bf3ff0b
Merge branch 'write-run-config-from-ui' into write-run-config-from-ui…
ajstewart Aug 10, 2020
cff213c
Finished tool tips and added units
ajstewart Aug 10, 2020
910a0d6
Moved tooltip js
ajstewart Aug 10, 2020
97274c7
Merge pull request #256 from askap-vast/write-run-config-from-ui-tool…
ajstewart Aug 11, 2020
bfd849a
add shading and focus disable to readonly tags
srggrs Aug 11, 2020
3a9b985
remove disabled from noise menu, moved under selavy
srggrs Aug 11, 2020
4f7bcc4
added feedback modal width, added edit config and hidden edit text
srggrs Aug 11, 2020
1356f90
enable edit toggle to activate config editing
srggrs Aug 11, 2020
648634d
deleted lefover bracket
srggrs Aug 11, 2020
a1213e0
fix response and errors initialisation of run
srggrs Aug 12, 2020
ba6f71f
fix comments, removed old code
srggrs Aug 12, 2020
955adc9
fix meas count on home view
srggrs Aug 12, 2020
e9a0989
improved check for calculating nr measurements
srggrs Aug 12, 2020
91a9db1
Minor job config changes
ajstewart Aug 12, 2020
9225643
Added 'De Ruiter only' to 'Association Beam Width' title
ajstewart Aug 12, 2020
b13000b
removed css class, fix syntax highlight, fix write text
srggrs Aug 12, 2020
dbc89ba
Merge branch 'write-run-config-from-ui' of github.com:askap-vast/vast…
srggrs Aug 12, 2020
34ac0b3
fix some tooltip text, grey out assoc beam width
srggrs Aug 12, 2020
c44462a
Merge branch 'master' into write-run-config-from-ui
srggrs Aug 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ function modules() {
var bootstrapJS = gulp.src('./node_modules/bootstrap/dist/js/*')
.pipe(gulp.dest(paths.vendor + '/bootstrap/js'));

// Bootstrap Select
var bootstrapSelectJS = gulp.src('./node_modules/bootstrap-select/dist/js/*')
.pipe(gulp.dest(paths.vendor + '/bootstrap-select/js'));
var bootstrapSelectCSS = gulp.src('./node_modules/bootstrap-select/dist/css/*')
.pipe(gulp.dest(paths.vendor + '/bootstrap-select/css'));

// ChartJS
var chartJS = gulp.src([
'./node_modules/chart.js/dist/*.js',
Expand Down Expand Up @@ -180,7 +186,19 @@ function modules() {
var particlesJs = gulp.src('./node_modules/particles.js/particles.js')
.pipe(gulp.dest(paths.vendor + '/particles.js'));

return merge(bootstrapJS, chartJS, dataTables, fontAwesome, jquery, jqueryEasing, d3Celestial, d3CelestialData, d3CelestialImage, particlesJs);
// PrismJs
var prismJs = gulp.src('./node_modules/prismjs/prism.js')
.pipe(gulp.dest(paths.vendor + '/prismjs'));
var prismJsPy = gulp.src('./node_modules/prismjs/components/prism-python.min.js')
.pipe(gulp.dest(paths.vendor + '/prismjs'));
var prismJsLineNum = gulp.src('./node_modules/prismjs/plugins/line-numbers/prism-line-numbers.min.js')
.pipe(gulp.dest(paths.vendor + '/prismjs/line-numbers'));
var prismJsCss = gulp.src('./node_modules/prismjs/themes/prism.css')
.pipe(gulp.dest(paths.vendor + '/prismjs'));
var prismJsLineNumCss = gulp.src('./node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css')
.pipe(gulp.dest(paths.vendor + '/prismjs/line-numbers'));

return merge(bootstrapJS, chartJS, dataTables, fontAwesome, jquery, jqueryEasing, d3Celestial, d3CelestialData, d3CelestialImage, particlesJs, prismJs, prismJsPy, prismJsLineNum, prismJsCss, prismJsLineNumCss);
}

// CSS task
Expand Down
51 changes: 51 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@
"dependencies": {
"@fortawesome/fontawesome-free": "5.12.0",
"bootstrap": "4.4.1",
"bootstrap-select": "^1.13.18",
"chart.js": "2.9.3",
"chartjs-plugin-error-bars": "^1.2.2",
"d3-celestial": "^0.7.17",
"datatables.net-bs4": "1.10.20",
"jquery": "3.4.1",
"jquery.easing": "^1.4.1",
"js9": "git+https://github.com/ericmandel/js9.git#v3.0",
"particles.js": "^2.0.0"
"particles.js": "^2.0.0",
"prismjs": "^1.21.0"
},
"devDependencies": {
"@babel/core": "^7.10.2",
Expand Down
24 changes: 8 additions & 16 deletions pipeline/config_template.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,26 @@ PIPE_RUN_PATH = os.path.dirname(os.path.realpath(__file__))
# IMAGE_FILES[0] image matches SELAVY_FILES[0] file
IMAGE_FILES = [
# insert images file path(s) here
{% for el in image_files %}
{{ el }},
{% endfor %}
]
{% for el in image_files %}'{{ el }}',
{% endfor %}]

# Selavy catalogue files
SELAVY_FILES = [
# insert Selavy file path(s) here
{% for el in selavy_files %}
{{ el }},
{% endfor %}
]
{% for el in selavy_files %}'{{ el }}',
{% endfor %}]

# background map files
BACKGROUND_FILES = [
# insert background map file path(s) here
{% for el in background_files %}
{{ el }},
{% endfor %}
]
{% for el in background_files %}'{{ el }}',
{% endfor %}]

# Noise or RMS files
NOISE_FILES = [
# insert RMS file path(s) here
{% for el in noise_files %}
{{ el }},
{% endfor %}
]
{% for el in noise_files %}'{{ el }}',
{% endfor %}]

###
# SOURCE FINDER OPTIONS
Expand Down
23 changes: 23 additions & 0 deletions pipeline/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django import forms
from .models import Run


class PipelineRunForm(forms.Form):
run_name = forms.CharField(
max_length=Run._meta.get_field('name').max_length
)
run_comment = forms.CharField(widget=forms.Textarea(), required=False)
monitor = forms.BooleanField(required=False)
monitor_min_sigma = forms.FloatField()
monitor_edge_buffer_scale = forms.FloatField()
association_method = forms.CharField()
astrometric_uncertainty_ra = forms.FloatField()
association_radius = forms.FloatField()
astrometric_uncertainty_dec = forms.FloatField()
association_de_ruiter_radius = forms.FloatField()
new_source_min_sigma = forms.FloatField()
default_survey = forms.CharField()
association_beamwidth_limit = forms.FloatField()
flux_perc_error = forms.FloatField()
selavy_local_rms_zero_fill_value = forms.FloatField()
use_condon_errors = forms.BooleanField(required=False)
73 changes: 47 additions & 26 deletions pipeline/management/commands/initpiperun.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,53 @@
from jinja2 import Template

from pipeline.models import Run
from pipeline.pipeline.errors import PipelineInitError
from pipeline.pipeline.utils import get_create_p_run


logger = logging.getLogger(__name__)


def initialise_run(run_name, run_comment='', user=None, config=None):
# check for duplicated run name
p_run = Run.objects.filter(name__exact=run_name)
if p_run:
msg = 'Pipeline run name already used. Change name'
raise PipelineInitError(msg)

# create the pipeline run folder
run_path = os.path.join(cfg.PIPELINE_WORKING_DIR, run_name)

if os.path.exists(run_path):
msg = 'pipeline run path already present!'
raise PipelineInitError(msg)
else:
logger.info('creating pipeline run folder')
os.mkdir(run_path)

# copy default config into the pipeline run folder
logger.info('copying default config in pipeline run folder')
template_f = os.path.join(
cfg.BASE_DIR,
'pipeline',
'config_template.py.j2'
)
with open(template_f, 'r') as fp:
template_str = fp.read()

tm = Template(template_str)
with open(os.path.join(run_path, 'config.py'), 'w') as fp:
if config:
fp.write(tm.render(**config))
else:
fp.write(tm.render(**cfg.PIPE_RUN_CONFIG_DEFAULTS))

# create entry in db
p_run = get_create_p_run(run_name, run_path, run_comment, user)

return p_run


class Command(BaseCommand):
"""
This script initialise the Pipeline Run folder and related config
Expand Down Expand Up @@ -40,33 +83,11 @@ def handle(self, *args, **options):
options['traceback'] = True

name = options['run_folder_path'][0]
# check for duplicated run name
p_run = Run.objects.filter(name__exact=name)
if p_run:
raise CommandError('Pipeline run name already used. Change name')

# create the pipeline run folder
ds_path = os.path.join(cfg.PIPELINE_WORKING_DIR, name)

if os.path.exists(ds_path):
raise CommandError('pipeline run path already present!')
else:
logger.info('creating pipeline run folder')
os.mkdir(ds_path)

# copy default config into the pipeline run folder
logger.info('copying default config in pipeline run folder')
template_f = os.path.join(
cfg.BASE_DIR,
'pipeline',
'config_template.py.j2'
)
with open(template_f, 'r') as fp:
template_str = fp.read()

tm = Template(template_str)
with open(os.path.join(ds_path, 'config.py'), 'w') as fp:
fp.write(tm.render(**cfg.PIPE_RUN_CONFIG_DEFAULTS))
try:
p_run = initialise_run(name)
except Exception as e:
raise CommandError(e)

logger.info((
'pipeline run initialisation successful! Please modify the '
Expand Down
3 changes: 3 additions & 0 deletions pipeline/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by Django 3.0.5 on 2020-08-12 04:41

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
Expand All @@ -10,6 +11,7 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
Expand Down Expand Up @@ -90,6 +92,7 @@ class Migration(migrations.Migration):
('status', models.CharField(choices=[('INI', 'Initialised'), ('RUN', 'Running'), ('END', 'Completed'), ('ERR', 'Error')], default='INI', help_text='Status of the pipeline run.', max_length=3)),
('n_images', models.IntegerField(default=0, help_text='number of images processed in this run')),
('n_sources', models.IntegerField(default=0, help_text='number of sources extracted in this run')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['name'],
Expand Down
3 changes: 3 additions & 0 deletions pipeline/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import math
from django.db import models
from django.core.validators import RegexValidator
from django.contrib.auth.models import User


# Create your models here.
Expand Down Expand Up @@ -129,6 +130,8 @@ class Run(models.Model):
A Run is essentially a pipeline run/processing istance over a set of
images
"""
user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)

name = models.CharField(
max_length=64,
unique=True,
Expand Down
11 changes: 9 additions & 2 deletions pipeline/pipeline/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class PipelineError(Exception):

def __init__(self, msg=None):
self.msg = (
'Generic Pipeline error: {0}.'.format(msg) if msg else
'Generic Pipeline error.'
'Pipeline error: {0}.'.format(msg) if msg else
'Undefined Pipeline error.'
)

def __str__(self):
Expand All @@ -29,3 +29,10 @@ class PipelineConfigError(PipelineError):
def __init__(self, msg=None):
super(PipelineConfigError, self).__init__(msg)


class PipelineInitError(PipelineError):
"""
Error for issue in the pipeline initialisation
"""
def __init__(self, msg=None):
super(PipelineInitError, self).__init__(msg)
Loading