Comments (3)
Jobs must be run in new R process. We can start a new process using the package callr. The package provides basic functionality to interact with R process and can be used to build some dynamic fields of jobs
endpoint response.
# Get all needed parameter to create a new API object
params <- api_params(api)
# params content:
# list(id = ..., title, description, backend_version, api_version, processes_file, collections)
# Create a new api object based on input parameters (to be run in **new process** side):
api <- api_from_params(params)
# This should be an openeocraft function
api_new_job <- function(api, req, res) {
user <- user_session(req)
p <- req$body
if ("process" %in% names(p))
p <- p$process
job <- job_create(api, p, user)
job_save(job) # user is a variable that identifies the current user
return(job)
}
# Possible implementation of `job_start()`
job_start <- function(job) {
callr::r(function() {
api <- job_api(job)
p <- job_pgraph(job)
result <- run_pgraph(api, p)
job_save_result(job, result) # user workspace
})
}
The endpoint implementation (plumber.R
) could be:
#* @post /jobs
function(req, res) {
job <- api_new_job(api, req, res)
job_start(job)
return(job_info(job))
}
#* @get /jobs/<job_id>
function(req, res, job_id) {
job <- job_read(api, res, req, job_id)
return(job_info(job))
}
#* @delete /jobs/<job_id>
function(req, res, job_id) {
job <- job_delete(api, res, req, job_id) # inside job_delete: user <- user_session(req)
return(job_info(job))
}
Possible new functions:
job_save_result()
job_api()
job_save()
job_read()
job_delete()
job_create()
job_api_params()
job_start()
job_info()
This issue depends on #18 to be able to define workspace.
from openeocraft.
from openeocraft.
Possible new functions:
job_save_result()
job_api()
job_save()
job_read()
job_delete()
job_create()
job_api_params()
job_start()
job_info()
- job_update()
- job_get_results()
- jobs_list_all()
from openeocraft.
Related Issues (20)
- Document exported functions
- Make `stars` work with `array_element()` process function
- Containerize the software using `Docker`
- L1 Minimum - API fundamentals HOT 1
- L1 Minimum - Well-known Discovery
- L1 Minimum - Capabilities
- L1 Minimum - File Formats
- L1 Minimum - Authentication
- L1 Minimum - Pre-defined Processes
- L1 Minimum - Collections
- L1 Minimum - Data Processing
- Use `openstac` to manage sits collections in openeocraft HOT 1
- Enable Cross-origin Resource Sharing (CORS)
- Check native support for charset UTF-8 HOT 1
- Implement error handling
- Bearer token follows the specified format (method/identityProviderId/token) HOT 1
- Change `api_result()` and `job_get_results()` functions
- Implement `save_result()` api function
- Improve decorators for processes JSON generation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openeocraft.