Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
20a91b4b
Commit
20a91b4b
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
Updated mol-task
parent
f52ee9db
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-model/structure/query/modifers.ts
+44
-0
44 additions, 0 deletions
src/mol-model/structure/query/modifers.ts
src/mol-task/execution/observable.ts
+4
-0
4 additions, 0 deletions
src/mol-task/execution/observable.ts
src/mol-task/task.ts
+9
-1
9 additions, 1 deletion
src/mol-task/task.ts
with
57 additions
and
1 deletion
src/mol-model/structure/query/modifers.ts
0 → 100644
+
44
−
0
View file @
20a91b4b
// /**
// * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
// *
// * @author David Sehnal <david.sehnal@gmail.com>
// */
// import Query from './query'
// import Selection from './selection'
// import P from './properties'
// import { Element, Unit } from '../structure'
// import { OrderedSet, Segmentation } from 'mol-data/int'
// import { LinearGroupingBuilder } from './utils/builders';
// export function wholeResidues(query: Query, isFlat: boolean): Query.Provider {
// return async (structure, ctx) => {
// const selection = query(structure).runAsChild(ctx);
// const { units } = structure;
// const l = Element.Location();
// const builder = structure.subsetBuilder(true);
// for (const unit of units) {
// l.unit = unit;
// const elements = unit.elements;
// builder.beginUnit(unit.id);
// for (let j = 0, _j = elements.length; j < _j; j++) {
// l.element = elements[j];
// if (atomTest(l)) builder.addElement(l.element);
// }
// builder.commitUnit();
// if (ctx.shouldUpdate) await ctx.update({ message: 'Atom Groups', current: 0, max: units.length });
// }
// return Selection.Singletons(structure, builder.getStructure());
// };
// }
// export interface IncludeSurroundingsParams {
// selection: Selection,
// radius: number,
// atomRadius?: number,
// wholeResidues?: boolean
// }
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-task/execution/observable.ts
+
4
−
0
View file @
20a91b4b
...
@@ -21,6 +21,10 @@ export function ExecuteObservable<T>(task: Task<T>, observer: Progress.Observer,
...
@@ -21,6 +21,10 @@ export function ExecuteObservable<T>(task: Task<T>, observer: Progress.Observer,
return
execute
(
task
as
ExposedTask
<
T
>
,
ctx
);
return
execute
(
task
as
ExposedTask
<
T
>
,
ctx
);
}
}
export
function
ExecuteInContext
<
T
>
(
ctx
:
RuntimeContext
,
task
:
Task
<
T
>
)
{
return
execute
(
task
as
ExposedTask
<
T
>
,
ctx
as
ObservableRuntimeContext
);
}
export
function
ExecuteObservableChild
<
T
>
(
ctx
:
RuntimeContext
,
task
:
Task
<
T
>
,
progress
?:
string
|
Partial
<
RuntimeContext
.
ProgressUpdate
>
)
{
export
function
ExecuteObservableChild
<
T
>
(
ctx
:
RuntimeContext
,
task
:
Task
<
T
>
,
progress
?:
string
|
Partial
<
RuntimeContext
.
ProgressUpdate
>
)
{
return
(
ctx
as
ObservableRuntimeContext
).
runChild
(
task
,
progress
);
return
(
ctx
as
ObservableRuntimeContext
).
runChild
(
task
,
progress
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/mol-task/task.ts
+
9
−
1
View file @
20a91b4b
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import
{
RuntimeContext
}
from
'
./execution/runtime-context
'
import
{
RuntimeContext
}
from
'
./execution/runtime-context
'
import
{
Progress
}
from
'
./execution/progress
'
import
{
Progress
}
from
'
./execution/progress
'
import
{
ExecuteObservable
,
ExecuteObservableChild
}
from
'
./execution/observable
'
;
import
{
ExecuteObservable
,
ExecuteObservableChild
,
ExecuteInContext
}
from
'
./execution/observable
'
;
import
{
SyncRuntimeContext
}
from
'
mol-task/execution/synchronous
'
;
import
{
SyncRuntimeContext
}
from
'
mol-task/execution/synchronous
'
;
// A "named function wrapper" with built in "computation tree progress tracking".
// A "named function wrapper" with built in "computation tree progress tracking".
...
@@ -21,6 +21,9 @@ interface Task<T> {
...
@@ -21,6 +21,9 @@ interface Task<T> {
// Allow to pass the progress so that the progress tree can be kept in a "good state" without having to separately call update.
// Allow to pass the progress so that the progress tree can be kept in a "good state" without having to separately call update.
runAsChild
(
ctx
:
RuntimeContext
,
progress
?:
string
|
Partial
<
RuntimeContext
.
ProgressUpdate
>
):
Promise
<
T
>
runAsChild
(
ctx
:
RuntimeContext
,
progress
?:
string
|
Partial
<
RuntimeContext
.
ProgressUpdate
>
):
Promise
<
T
>
// Run the task on the specified context.
runInContext
(
ctx
:
RuntimeContext
):
Promise
<
T
>
readonly
id
:
number
,
readonly
id
:
number
,
readonly
name
:
string
readonly
name
:
string
}
}
...
@@ -39,6 +42,11 @@ namespace Task {
...
@@ -39,6 +42,11 @@ namespace Task {
return
ExecuteObservableChild
(
ctx
,
this
,
progress
as
string
|
Partial
<
RuntimeContext
.
ProgressUpdate
>
);
return
ExecuteObservableChild
(
ctx
,
this
,
progress
as
string
|
Partial
<
RuntimeContext
.
ProgressUpdate
>
);
}
}
runInContext
(
ctx
:
RuntimeContext
):
Promise
<
T
>
{
if
(
ctx
.
isSynchronous
)
return
this
.
f
(
SyncRuntimeContext
);
return
ExecuteInContext
(
ctx
,
this
);
}
constructor
(
public
name
:
string
,
public
f
:
(
ctx
:
RuntimeContext
)
=>
Promise
<
T
>
,
public
onAbort
?:
()
=>
void
)
{
constructor
(
public
name
:
string
,
public
f
:
(
ctx
:
RuntimeContext
)
=>
Promise
<
T
>
,
public
onAbort
?:
()
=>
void
)
{
this
.
id
=
nextId
();
this
.
id
=
nextId
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment