Skip to content

Conversation

@arunapa
Copy link
Contributor

@arunapa arunapa commented Feb 9, 2023

  • Created 2 React custom components:
  • ExtractorStatus -- UI table to display summary of job/progress so far
  • ExtractorLogs -- terminal-like UI to display logs in real-time as they are being fetched

@arunapa arunapa self-assigned this Feb 9, 2023
@arunapa arunapa linked an issue Feb 9, 2023 that may be closed by this pull request
* Created 2 React custom components:
* ExtractorStatus -- UI table to display summary of job/progress so far
* ExtractorLogs -- terminal-like UI to display logs in real-time as they are being fetched
@arunapa arunapa force-pushed the 261-read-and-display-extractor-logs-on-frontend branch from 3a06ff0 to 0db3e9e Compare February 16, 2023 12:26
@tcnichol tcnichol self-requested a review February 16, 2023 15:28
@tcnichol
Copy link
Contributor

I'm getting the blank page error when I try to upload files here. Does this need main merged into it? That bug was fixed and merged in.

* Updated API endpoints, return payload, reducers and actions for the extractor jobs

* Tested API calls to fetchJobSummary, fetchJobUpdates from frontend, able to receive extractor job data

* Tested submit job process flow, able to retrieve extractor job id from the backend

* Removed redundant code

---------

Co-authored-by: Chen Wang <[email protected]>
@longshuicy longshuicy marked this pull request as ready for review February 16, 2023 21:41
* Tested with sample extractor logs, able to view both extractor status and summary from the UI
@arunapa arunapa changed the title Static UI for displaying logs on extractors UI for displaying logs on extractors Feb 17, 2023
@arunapa
Copy link
Contributor Author

arunapa commented Feb 17, 2023

Screen Shot 2023-02-17 at 10 44 08 AM

}
}, 2000);

return () => clearInterval(interval);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to clear this interval when leaving this widget; Right now it's continuing calling the endpoint every two seconds even though I close the modal.

The way of clearing the interval is to store the interval in state and give it a defaut:

Whenever you are setting the interval, make sure you update the state

const interval = setInterval(() => {
			if (isFormSubmitted == true && job_id.length > 0) {
				jobSummaryFetch(job_id);
				jobUpdatesFetch(job_id);
			}
		}, 2000);
setIntervalId(interval);

Then you can clear it this way

const _clear_old_timeinterval = () => {
		if (intervalId) {
			clearInterval(intervalId);
			setIntervalId(0);
		}
	};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why but I am running the wordcount extractor, but getting nothing for logs.

I merged main into the branch to fix the blank page error, so I hope that didn't mess something up.

ddey2 and others added 5 commits February 17, 2023 14:59
* Adding download button on UI to download correct verison file

* fix filename issue

* Update FileVersion.ts

---------

Co-authored-by: Chen Wang <[email protected]>
* fix member typing

* adjust the test so it can pass
files.py - renaming resubmit method
codegen
fixing error in listeners.py
@tcnichol
Copy link
Contributor

I pulled the latest and tested with wordcount but I'm still not seeing any logs. Is this dependent on any other pull requests, or do I need to add something to the db manually to test? Thanks.

@arunapa
Copy link
Contributor Author

arunapa commented Feb 22, 2023

I pulled the latest and tested with wordcount but I'm still not seeing any logs. Is this dependent on any other pull requests, or do I need to add something to the db manually to test? Thanks.

@tcnichol You should be able to see the UI even without any changes to the DB.
It will look something like this:
Screen Shot 2023-02-22 at 4 12 37 PM

I'm also trying to get an extractor running to test from my end, but in the meantime let me also share the steps to display static extractor logs.

Steps:

  1. If it is not already present, create a new mongo collection listener_jobs then listener_job_updates
  2. Add some sample logs to the collection, like the following
    listener_jobs:
{
    "_id" : ObjectId("63d146bc79a3d39c71d0e0b1"),
    "listener_id" : "ncsa.wordcount",
    "resource_ref" : {
        "collection" : "file",
        "resource_id" : ObjectId("63d140925cda10061fcd6768"),
        "version" : 1.0
    },
    "creator" : {
        "id" : ObjectId("63a32586cdf079dcd6077a1a"),
        "email" : "[email protected]",
        "first_name" : "Chen",
        "last_name" : "Wang"
    },
    "parameters" : {

    },
    "created" : ISODate("2023-01-25T15:11:56.615+0000"),
    "started" : null,
    "updated" : ISODate("2023-01-25T14:11:56.000+0000"),
    "finished" : null,
    "duration" : 500.0,
    "latest_message" : "StatusMessage.done: Done processing.",
    "status" : "StatusMessage.done: Done processing."
}

listener_job_updates:

{
    "_id" : ObjectId("63d146bdeac2ff40a3c8c31c"),
    "job_id" : "63d146bc79a3d39c71d0e0b1",
    "timestamp" : ISODate("2023-01-25T14:11:56.000+0000"),
    "status" : "StatusMessage.start: Started processing."
}
{
    "_id" : ObjectId("63d146bdeac2ff40a3c8c31e"),
    "job_id" : "63d146bc79a3d39c71d0e0b1",
    "timestamp" : ISODate("2023-01-25T14:11:56.000+0000"),
    "status" : "StatusMessage.processing: Downloading file."
}
{
    "_id" : ObjectId("63d146bdeac2ff40a3c8c320"),
    "job_id" : "63d146bc79a3d39c71d0e0b1",
    "timestamp" : ISODate("2023-01-25T14:11:56.000+0000"),
    "status" : "StatusMessage.processing: Loading contents of file..."
}
{
    "_id" : ObjectId("63d146bdeac2ff40a3c8c322"),
    "job_id" : "63d146bc79a3d39c71d0e0b1",
    "timestamp" : ISODate("2023-01-25T14:11:56.000+0000"),
    "status" : "StatusMessage.processing: Found 21 lines and 162 words..."
}
{
    "_id" : ObjectId("63d146bdeac2ff40a3c8c324"),
    "job_id" : "63d146bc79a3d39c71d0e0b1",
    "timestamp" : ISODate("2023-01-25T14:11:56.000+0000"),
    "status" : "StatusMessage.processing: Uploading file metadata."
}
{
    "_id" : ObjectId("63d146bdeac2ff40a3c8c326"),
    "job_id" : "63d146bc79a3d39c71d0e0b1",
    "timestamp" : ISODate("2023-01-25T14:11:56.000+0000"),
    "status" : "StatusMessage.done: Done processing."
}
  1. Modify the value of job_id in ExtractorStatus.tsx
--- a/frontend/src/components/listeners/ExtractorStatus.tsx
+++ b/frontend/src/components/listeners/ExtractorStatus.tsx
@@ -86,8 +86,8 @@ export default function ExtractorStatus(props: { job_id: any; }) {
        useEffect(() => {
                const interval = setInterval(() => {
                        if (job_id.length > 0) {
-                               jobSummaryFetch(job_id);
-                               jobUpdatesFetch(job_id);
+                               jobSummaryFetch('63d146bc79a3d39c71d0e0b1');
+                               jobUpdatesFetch('63d146bc79a3d39c71d0e0b1');
                        }
                }, 2000);

Copy link
Member

@longshuicy longshuicy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the steps you listed in the comment and it works well. Approving!

}, 2000);

return () => clearInterval(interval);
}, [job_id]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah i see. You need to move the timer logic into the status component instead of the parent component. Neat!

@max-zilla max-zilla merged commit 05311b7 into main Feb 28, 2023
@max-zilla max-zilla deleted the 261-read-and-display-extractor-logs-on-frontend branch February 28, 2023 14:52
longshuicy added a commit that referenced this pull request Feb 28, 2023
* Static UI for displaying logs on extractors

* Created 2 React custom components:
* ExtractorStatus -- UI table to display summary of job/progress so far
* ExtractorLogs -- terminal-like UI to display logs in real-time as they are being fetched

* [WIP] Enable extractor job id retrieval from backend

* Updated redux store value when job id is returned

* Added actions for job update, job summary API endpoints

* [WIP DO NOT MERGE] Testing frontend functionality with dynamic log rendering

* Updated API endpoints, return payload, reducers and actions (#330)

* Updated API endpoints, return payload, reducers and actions for the extractor jobs

* Tested API calls to fetchJobSummary, fetchJobUpdates from frontend, able to receive extractor job data

* Tested submit job process flow, able to retrieve extractor job id from the backend

* Removed redundant code

---------

Co-authored-by: Chen Wang <[email protected]>

* Integrated UI with backend

* Tested with sample extractor logs, able to view both extractor status and summary from the UI

* Removed hardcoding of job id

* Fixed indentation

* Adding download button on UI to download correct verison file (#334)

* Adding download button on UI to download correct verison file

* fix filename issue

* Update FileVersion.ts

---------

Co-authored-by: Chen Wang <[email protected]>

* fix member typing (#336)

* fix member typing

* adjust the test so it can pass

* fixing error of blank page on submit file to extractor (#338)

files.py - renaming resubmit method
codegen
fixing error in listeners.py

* Modified extractor job summary duration calculation

* Moving fetchJobSummary, fetchJobSummary API calls to ExtractorStatus component to fix interval issue

---------

Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Dipannita <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>
longshuicy added a commit that referenced this pull request Feb 28, 2023
* various fixes to message listener

* black formatting

* Added new component for file actions (#352)

* Added new component for file actions

* Tested file download and file delete from File page

* Verified after deleting file, page navigates back to main dataset page

* Fixed version-not-updating error

* Updated onSave sequence to first synchronously update the file and then subsequently call listVersions API to display on the frontend

* Fixed lint issues by running eslint

* UI for displaying logs on extractors (#317)

* Static UI for displaying logs on extractors

* Created 2 React custom components:
* ExtractorStatus -- UI table to display summary of job/progress so far
* ExtractorLogs -- terminal-like UI to display logs in real-time as they are being fetched

* [WIP] Enable extractor job id retrieval from backend

* Updated redux store value when job id is returned

* Added actions for job update, job summary API endpoints

* [WIP DO NOT MERGE] Testing frontend functionality with dynamic log rendering

* Updated API endpoints, return payload, reducers and actions (#330)

* Updated API endpoints, return payload, reducers and actions for the extractor jobs

* Tested API calls to fetchJobSummary, fetchJobUpdates from frontend, able to receive extractor job data

* Tested submit job process flow, able to retrieve extractor job id from the backend

* Removed redundant code

---------

Co-authored-by: Chen Wang <[email protected]>

* Integrated UI with backend

* Tested with sample extractor logs, able to view both extractor status and summary from the UI

* Removed hardcoding of job id

* Fixed indentation

* Adding download button on UI to download correct verison file (#334)

* Adding download button on UI to download correct verison file

* fix filename issue

* Update FileVersion.ts

---------

Co-authored-by: Chen Wang <[email protected]>

* fix member typing (#336)

* fix member typing

* adjust the test so it can pass

* fixing error of blank page on submit file to extractor (#338)

files.py - renaming resubmit method
codegen
fixing error in listeners.py

* Modified extractor job summary duration calculation

* Moving fetchJobSummary, fetchJobSummary API calls to ExtractorStatus component to fix interval issue

---------

Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Dipannita <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>

* Millisecond (#360)

* it's seconds

* add more icons

* default to open tab

---------

Co-authored-by: Aruna Parameswaran <[email protected]>
Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Dipannita <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>
longshuicy added a commit that referenced this pull request Mar 2, 2023
* Static UI for displaying logs on extractors

* Created 2 React custom components:
* ExtractorStatus -- UI table to display summary of job/progress so far
* ExtractorLogs -- terminal-like UI to display logs in real-time as they are being fetched

* [WIP] Enable extractor job id retrieval from backend

* Updated redux store value when job id is returned

* Added actions for job update, job summary API endpoints

* [WIP DO NOT MERGE] Testing frontend functionality with dynamic log rendering

* Updated API endpoints, return payload, reducers and actions (#330)

* Updated API endpoints, return payload, reducers and actions for the extractor jobs

* Tested API calls to fetchJobSummary, fetchJobUpdates from frontend, able to receive extractor job data

* Tested submit job process flow, able to retrieve extractor job id from the backend

* Removed redundant code

---------

Co-authored-by: Chen Wang <[email protected]>

* Integrated UI with backend

* Tested with sample extractor logs, able to view both extractor status and summary from the UI

* Removed hardcoding of job id

* Fixed indentation

* Adding download button on UI to download correct verison file (#334)

* Adding download button on UI to download correct verison file

* fix filename issue

* Update FileVersion.ts

---------

Co-authored-by: Chen Wang <[email protected]>

* fix member typing (#336)

* fix member typing

* adjust the test so it can pass

* fixing error of blank page on submit file to extractor (#338)

files.py - renaming resubmit method
codegen
fixing error in listeners.py

* Modified extractor job summary duration calculation

* Moving fetchJobSummary, fetchJobSummary API calls to ExtractorStatus component to fix interval issue

---------

Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Dipannita <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>
longshuicy added a commit that referenced this pull request Mar 2, 2023
* various fixes to message listener

* black formatting

* Added new component for file actions (#352)

* Added new component for file actions

* Tested file download and file delete from File page

* Verified after deleting file, page navigates back to main dataset page

* Fixed version-not-updating error

* Updated onSave sequence to first synchronously update the file and then subsequently call listVersions API to display on the frontend

* Fixed lint issues by running eslint

* UI for displaying logs on extractors (#317)

* Static UI for displaying logs on extractors

* Created 2 React custom components:
* ExtractorStatus -- UI table to display summary of job/progress so far
* ExtractorLogs -- terminal-like UI to display logs in real-time as they are being fetched

* [WIP] Enable extractor job id retrieval from backend

* Updated redux store value when job id is returned

* Added actions for job update, job summary API endpoints

* [WIP DO NOT MERGE] Testing frontend functionality with dynamic log rendering

* Updated API endpoints, return payload, reducers and actions (#330)

* Updated API endpoints, return payload, reducers and actions for the extractor jobs

* Tested API calls to fetchJobSummary, fetchJobUpdates from frontend, able to receive extractor job data

* Tested submit job process flow, able to retrieve extractor job id from the backend

* Removed redundant code

---------

Co-authored-by: Chen Wang <[email protected]>

* Integrated UI with backend

* Tested with sample extractor logs, able to view both extractor status and summary from the UI

* Removed hardcoding of job id

* Fixed indentation

* Adding download button on UI to download correct verison file (#334)

* Adding download button on UI to download correct verison file

* fix filename issue

* Update FileVersion.ts

---------

Co-authored-by: Chen Wang <[email protected]>

* fix member typing (#336)

* fix member typing

* adjust the test so it can pass

* fixing error of blank page on submit file to extractor (#338)

files.py - renaming resubmit method
codegen
fixing error in listeners.py

* Modified extractor job summary duration calculation

* Moving fetchJobSummary, fetchJobSummary API calls to ExtractorStatus component to fix interval issue

---------

Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Dipannita <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>

* Millisecond (#360)

* it's seconds

* add more icons

* default to open tab

---------

Co-authored-by: Aruna Parameswaran <[email protected]>
Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Dipannita <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>
max-zilla added a commit that referenced this pull request Mar 6, 2023
* Added group_id to authorization

* Added list of group_ids instead of one group_id per entry

* Addressing comments

* fixing lint failure

* Added new component for file actions (#352)

* Added new component for file actions

* Tested file download and file delete from File page

* Verified after deleting file, page navigates back to main dataset page

* Fixed version-not-updating error

* Updated onSave sequence to first synchronously update the file and then subsequently call listVersions API to display on the frontend

* Fixed lint issues by running eslint

* UI for displaying logs on extractors (#317)

* Static UI for displaying logs on extractors

* Created 2 React custom components:
* ExtractorStatus -- UI table to display summary of job/progress so far
* ExtractorLogs -- terminal-like UI to display logs in real-time as they are being fetched

* [WIP] Enable extractor job id retrieval from backend

* Updated redux store value when job id is returned

* Added actions for job update, job summary API endpoints

* [WIP DO NOT MERGE] Testing frontend functionality with dynamic log rendering

* Updated API endpoints, return payload, reducers and actions (#330)

* Updated API endpoints, return payload, reducers and actions for the extractor jobs

* Tested API calls to fetchJobSummary, fetchJobUpdates from frontend, able to receive extractor job data

* Tested submit job process flow, able to retrieve extractor job id from the backend

* Removed redundant code

---------

Co-authored-by: Chen Wang <[email protected]>

* Integrated UI with backend

* Tested with sample extractor logs, able to view both extractor status and summary from the UI

* Removed hardcoding of job id

* Fixed indentation

* Adding download button on UI to download correct verison file (#334)

* Adding download button on UI to download correct verison file

* fix filename issue

* Update FileVersion.ts

---------

Co-authored-by: Chen Wang <[email protected]>

* fix member typing (#336)

* fix member typing

* adjust the test so it can pass

* fixing error of blank page on submit file to extractor (#338)

files.py - renaming resubmit method
codegen
fixing error in listeners.py

* Modified extractor job summary duration calculation

* Moving fetchJobSummary, fetchJobSummary API calls to ExtractorStatus component to fix interval issue

---------

Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Dipannita <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>

* Properly interpret extractor statuses (#356)

* various fixes to message listener

* black formatting

* Added new component for file actions (#352)

* Added new component for file actions

* Tested file download and file delete from File page

* Verified after deleting file, page navigates back to main dataset page

* Fixed version-not-updating error

* Updated onSave sequence to first synchronously update the file and then subsequently call listVersions API to display on the frontend

* Fixed lint issues by running eslint

* UI for displaying logs on extractors (#317)

* Static UI for displaying logs on extractors

* Created 2 React custom components:
* ExtractorStatus -- UI table to display summary of job/progress so far
* ExtractorLogs -- terminal-like UI to display logs in real-time as they are being fetched

* [WIP] Enable extractor job id retrieval from backend

* Updated redux store value when job id is returned

* Added actions for job update, job summary API endpoints

* [WIP DO NOT MERGE] Testing frontend functionality with dynamic log rendering

* Updated API endpoints, return payload, reducers and actions (#330)

* Updated API endpoints, return payload, reducers and actions for the extractor jobs

* Tested API calls to fetchJobSummary, fetchJobUpdates from frontend, able to receive extractor job data

* Tested submit job process flow, able to retrieve extractor job id from the backend

* Removed redundant code

---------

Co-authored-by: Chen Wang <[email protected]>

* Integrated UI with backend

* Tested with sample extractor logs, able to view both extractor status and summary from the UI

* Removed hardcoding of job id

* Fixed indentation

* Adding download button on UI to download correct verison file (#334)

* Adding download button on UI to download correct verison file

* fix filename issue

* Update FileVersion.ts

---------

Co-authored-by: Chen Wang <[email protected]>

* fix member typing (#336)

* fix member typing

* adjust the test so it can pass

* fixing error of blank page on submit file to extractor (#338)

files.py - renaming resubmit method
codegen
fixing error in listeners.py

* Modified extractor job summary duration calculation

* Moving fetchJobSummary, fetchJobSummary API calls to ExtractorStatus component to fix interval issue

---------

Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Dipannita <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>

* Millisecond (#360)

* it's seconds

* add more icons

* default to open tab

---------

Co-authored-by: Aruna Parameswaran <[email protected]>
Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Dipannita <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>

* Context matches v1 type. (#328)

* context is now changed to list union of AnyUrl or dict. This should make v2 compatible with some extractors from extractors-core which dynamically build the context.

* formatting
fix test

* formatting

* still getting pytest errors
changed context from optional[list] to list with default value empty, but still is not fixing the issues.

* should fix the tests

* formatting

* getting rid of class 'context element' not needed

* getting rid of class 'context element' not needed

* removing console log

---------

Co-authored-by: Chen Wang <[email protected]>

* Mongo views (#353)

* add a readme

* add listener job update view

* temp

* add init

* add to production docker-compose as well

* 343 list resources that user has access (#355)

* add logic to filter user

* add filters to file

* list files working too

* add same filter for folder

* include executions

* exempt the current resource owner

* add test database

* rewrite createView part

* rewrite init script but it's still not working yet

* fix typo

* fix linting

* Replaced EmbeddedSearch with custom search box component to fix session refresh issue (#365)

* Tested dataset search by clicking button and pressing enter, able to view search results

* match user_ids which is a list now (#368)

* update to lookup query

* update authorization_deps queries

* simplify group logic in auth check

* formatting

* Formatting

---------

Co-authored-by: Aruna Parameswaran <[email protected]>
Co-authored-by: Chen Wang <[email protected]>
Co-authored-by: Todd Nicholson <[email protected]>
Co-authored-by: Max Burnette <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Read and display extractor logs on frontend

6 participants