How to use the parsl.monitoring.web_app.app.close_db function in parsl

To help you get started, we’ve selected a few parsl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Parsl / parsl / parsl / monitoring / web_app / plots / default / total_tasks.py View on Github external
def setup(self, run_id, columns=20):
        sql_conn = get_db()
        df_status = pd.read_sql_query('SELECT run_id, task_id, task_status_name, timestamp FROM task_status WHERE run_id=(?)',
                                      sql_conn, params=(run_id, ))
        close_db()

        min_time = timestamp_to_int(min(df_status['timestamp']))
        max_time = timestamp_to_int(max(df_status['timestamp']))

        time_step = int((max_time - min_time) / columns)
        minutes = time_step // 60
        seconds = time_step % 60

        return [html.H4('Bin width'),
                html.Div(children=[html.Label(htmlFor='bin_width_minutes', children='Minutes'),
                                   dcc.Input(id='bin_width_minutes', type='number', min=0, value=minutes)]),
                html.Div(children=[html.Label(htmlFor='bin_width_seconds', children='Seconds'),
                                   dcc.Input(id='bin_width_seconds', type='number', min=0, value=seconds)])]
github funcx-faas / funcX / funcx / executor / parsl / monitoring / web_app / plots / default / total_tasks.py View on Github external
def setup(self, run_id, columns=20):
        sql_conn = get_db()
        df_status = pd.read_sql_query('SELECT run_id, task_id, task_status_name, timestamp FROM task_status WHERE run_id=(?)',
                                      sql_conn, params=(run_id, ))
        close_db()

        min_time = timestamp_to_int(min(df_status['timestamp']))
        max_time = timestamp_to_int(max(df_status['timestamp']))

        time_step = int((max_time - min_time) / columns)
        minutes = time_step // 60
        seconds = time_step % 60

        return [html.P('Bin width'),
                html.Label(htmlFor='bin_width_minutes', children='Minutes'),
                dcc.Input(id='bin_width_minutes', type='number', min=0, value=minutes),
                html.Label(htmlFor='bin_width_seconds', children='Seconds'),
                dcc.Input(id='bin_width_seconds', type='number', min=0, value=seconds)]
github Parsl / parsl / parsl / monitoring / web_app / apps / tasks_details.py View on Github external
def tasks_details(run_id, pathname):
    sql_conn = get_db()
    df_task = pd.read_sql_query('SELECT task_id, task_func_name FROM task WHERE run_id=(?)',
                                sql_conn, params=(run_id,))
    close_db()

    tasks = []
    for task_id in df_task['task_id']:
        tasks.append({'label': task_id, 'value': task_id})

    return [html.P(className='view_title', children='Tasks view'),
            html.Div(id='select_task_id',
                     children=[
                         html.H4('Select Task ID'),
                         dcc.Dropdown(
                             id='tasks_dropdown',
                             options=tasks,
                             value=pathname.split('/').pop())
                     ])
            ] + [plot.html(run_id) for plot in plots]
github funcx-faas / funcX / funcx / executor / parsl / monitoring / web_app / plots / default / total_tasks.py View on Github external
df_status = pd.read_sql_query('SELECT run_id, task_id, task_status_name, timestamp FROM task_status WHERE run_id=(?)',
                                      sql_conn, params=(run_id, ))

        if apps:
            if type(apps) is dict:
                apps = ['', apps['label']]
            elif len(apps) == 1:
                apps.append('')

            df_task = pd.read_sql_query('SELECT task_id, task_func_name FROM task WHERE run_id=(?) AND task_func_name IN {apps}'.format(apps=tuple(apps)),
                                        sql_conn, params=(run_id, ))
        else:
            df_task = pd.read_sql_query('SELECT task_id, task_func_name FROM task WHERE run_id=(?)',
                                        sql_conn, params=(run_id, ))

        close_db()

        min_time = timestamp_to_int(min(df_status['timestamp']))
        max_time = timestamp_to_int(max(df_status['timestamp']))
        time_step = 60 * minutes + seconds

        x_axis = []
        for i in range(min_time, max_time, time_step):
            x_axis.append(num_to_timestamp(i).strftime(DB_DATE_FORMAT))

        # Fill up dict "apps" like: {app1: [#task1, #task2], app2: [#task4], app3: [#task3]}
        apps_dict = dict()
        for i in range(len(df_task)):
            row = df_task.iloc[i]
            if row['task_func_name'] in apps_dict:
                apps_dict[row['task_func_name']].append(row['task_id'])
            else:
github Parsl / parsl / parsl / monitoring / web_app / plots / default / memory_usage.py View on Github external
def plot(self, option, columns, run_id):
        sql_conn = get_db()
        df_resources = pd.read_sql_query('SELECT psutil_process_memory_virtual, timestamp, task_id FROM task_resources WHERE run_id=(?)',
                                         sql_conn, params=(run_id, ))
        df_task = pd.read_sql_query('SELECT task_id, task_time_returned FROM task WHERE run_id=(?)',
                                    sql_conn, params=(run_id, ))
        close_db()

        min_range = min(df_resources['psutil_process_memory_virtual'].astype('float'))
        max_range = max(df_resources['psutil_process_memory_virtual'].astype('float'))
        time_step = (max_range - min_range) / columns

        x_axis = []
        for i in np.arange(min_range, max_range + time_step, time_step):
            x_axis.append(i)

        apps_dict = dict()
        for i in range(len(df_task)):
            row = df_task.iloc[i]
            apps_dict[row['task_id']] = []

        def y_axis_setup():
            items = []
github Parsl / parsl / parsl / monitoring / web_app / apps / apps_details.py View on Github external
def tasks_details(run_id):
    sql_conn = get_db()
    df_task = pd.read_sql_query('SELECT task_id, task_func_name FROM task WHERE run_id=(?)',
                                sql_conn, params=(run_id,))
    close_db()

    apps = []
    for _app in df_task['task_func_name'].unique():
        apps.append(dict(label=_app, value=_app))

    return [html.P(className='view_title', children='Apps view'),
            html.Div(id='select_apps',
                     children=[
                         html.H4('Select apps'),
                         dcc.Dropdown(
                             id='apps_dropdown',
                             options=apps,
                             value=apps[0],
                             multi=True)
                     ])
            ] + [plot.html(run_id) for plot in plots]
github Parsl / parsl / parsl / monitoring / web_app / plots / default / system_time.py View on Github external
def plot(self, option, columns, run_id):
        sql_conn = get_db()
        df_resources = pd.read_sql_query('SELECT psutil_process_time_system, timestamp, task_id FROM task_resources WHERE run_id=(?)',
                                         sql_conn, params=(run_id, ))
        df_task = pd.read_sql_query('SELECT task_id, task_time_returned FROM task WHERE run_id=(?)',
                                    sql_conn, params=(run_id, ))
        close_db()

        min_range = min(df_resources['psutil_process_time_system'].astype('float'))
        max_range = max(df_resources['psutil_process_time_system'].astype('float'))
        time_step = (max_range - min_range) / columns

        x_axis = []
        for i in np.arange(min_range, max_range + time_step, time_step):
            x_axis.append(i)

        apps_dict = dict()
        for i in range(len(df_task)):
            row = df_task.iloc[i]
            apps_dict[row['task_id']] = []

        def y_axis_setup():
            items = []
github funcx-faas / funcX / funcx / executor / parsl / monitoring / web_app / apps / tasks_details.py View on Github external
def tasks_per_app_plot_callback(apps, run_id):
    if type(apps) is dict:
        apps = ['', apps['label']]
    elif len(apps) == 1:
        apps.append('')

    sql_conn = get_db()
    df_status = pd.read_sql_query('SELECT run_id, task_id, task_status_name, timestamp FROM task_status WHERE run_id=(?)',
                                  sql_conn, params=(run_id, ))
    df_task = pd.read_sql_query('SELECT task_id, task_func_name FROM task WHERE run_id=(?) AND task_fn_hash IN {apps}'.format(apps=tuple(apps)),
                                sql_conn, params=(run_id, ))
    close_db()

    def y_axis_setup(array):
        count = 0
        items = []
        for n in array:
            if n:
                count += 1
            elif count > 0:
                count -= 1
            items.append(count)

        return items

    # Fill up dict "apps" like: {app1: [#task1, #task2], app2: [#task4], app3: [#task3]}
    apps = dict()
    for i in range(len(df_task)):
github funcx-faas / funcX / funcx / executor / parsl / monitoring / web_app / apps / tabs.py View on Github external
def display_workflow(workflow_name):
    sql_conn = get_db()
    df_workflows = pd.read_sql_query('SELECT workflow_name, time_began, rundir, run_id FROM workflows WHERE workflow_name=(?)',
                                     sql_conn, params=(workflow_name, ))
    close_db()
    return html.Div(children=[
        html.H2(id='workflow_name', children=df_workflows['workflow_name'][0]),
        dropdown(id='run_number_dropdown', dataframe=df_workflows.sort_values(by='time_began', ascending=False), field='rundir'),
        dcc.Tabs(id="tabs", value='workflow', children=[
            dcc.Tab(label='Workflow', value='workflow'),
            dcc.Tab(label='Tasks', value='tasks'),
        ]),
        html.Div(id='tabs-content')
    ])
github funcx-faas / funcX / funcx / executor / parsl / monitoring / web_app / apps / tasks_details.py View on Github external
def tasks_details(run_id):
    sql_conn = get_db()
    df_task = pd.read_sql_query('SELECT task_id, task_func_name FROM task WHERE run_id=(?)',
                                sql_conn, params=(run_id,))
    close_db()

    apps = []
    for _app in df_task['task_func_name'].unique():
        apps.append(dict(label=_app, value=_app))

    return [dcc.Dropdown(
        id='apps_dropdown',
        options=apps,
        value=apps[0],
        multi=True),
        tasks_per_app_plot(run_id),
        total_tasks_plot(run_id)]