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

Fix #6653: subsims during write params #6759

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9d7c109
Fix #6653: opal ckp
Feb 8, 2024
6020ae8
Fix #6653: ckp elegant
Feb 8, 2024
6602b8e
Fix #6653: cleanup ckp
Feb 8, 2024
bde26a8
Fix #6653: ckp
Feb 8, 2024
4b805b6
Fix #6653: ckp
Feb 9, 2024
8f96c61
Fix #6653: just gen sim dirs no prev output
Feb 9, 2024
b87684c
Fix #6653: cleanup
Feb 9, 2024
f4c64fa
Merge branch 'master' into 6653-subsims-during-write-params
Feb 12, 2024
40e3cae
Merge branch 'master' into 6653-subsims-during-write-params
moellep Mar 15, 2024
3c47238
merge with master
moellep Apr 1, 2024
d7664ec
include folder name in sim list
moellep Apr 15, 2024
f51cca2
for #6653 use lume classes for running omega sims
moellep Apr 15, 2024
f78e815
moved sim list load to controller to avoid multiple calls
moellep Apr 15, 2024
dd63d10
for the dpa genesis plot, assume only 1 frame
moellep Apr 15, 2024
4162821
Merge branch 'master' into 6653-subsims-during-write-params
moellep Apr 17, 2024
8c2646f
Fix #7014: plotting ckp
gurhar1133 Apr 18, 2024
6c30230
Fix #7014: ckp
gurhar1133 Apr 19, 2024
c0ed930
Fix #7014: ckp
gurhar1133 Apr 19, 2024
b0d06aa
Fix #7014: cleanup
gurhar1133 Apr 19, 2024
3813f92
Fix #7021: ckp
gurhar1133 Apr 22, 2024
af15a6b
Fix #7021: note
gurhar1133 Apr 22, 2024
96bb192
Fix #7021: ckp
gurhar1133 Apr 23, 2024
1c8f94d
Fix #7021: ckp
gurhar1133 Apr 23, 2024
67679e5
Fix #7021: just using particleGroup
gurhar1133 Apr 23, 2024
0eaab5f
Merge branch 'master' into 6653-subsims-during-write-params
moellep Apr 29, 2024
d862e01
for #6653 update omega_test, move relate sim check to server
moellep Apr 29, 2024
13d9b00
for #6653 improve omega code generation and dark-mode improvements
moellep Apr 29, 2024
0b376f2
for #6653 remove NaN particles.
moellep May 1, 2024
4649f06
Merge branch 'master' into 6653-subsims-during-write-params
moellep May 13, 2024
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
12 changes: 8 additions & 4 deletions sirepo/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
class LibAdapterBase:
"""Common functionality between code specific LibAdapter implementations."""

def __init__(self, ignore_files=None):
def __init__(self, ignore_files=None, update_filenames=False):
m = inspect.getmodule(self)
self._sim_data, _, self._schema = sirepo.sim_data.template_globals(m.SIM_TYPE)
self._code_var = m.code_var
self._ignore_files = ignore_files if ignore_files else []
self._update_filenames = update_filenames

def _convert(self, data):
def _model(model, name):
Expand Down Expand Up @@ -77,7 +78,9 @@ def _write_input_files(self, data, source_path, dest_dir):
for f in set(
LatticeUtil(data, self._schema)
.iterate_models(
lattice.InputFileIterator(self._sim_data, update_filenames=False),
lattice.InputFileIterator(
self._sim_data, update_filenames=self._update_filenames
),
)
.result,
):
Expand Down Expand Up @@ -112,11 +115,12 @@ class Importer:
ignore_files (list): files ignored during verification and symlink routines [None]
"""

def __init__(self, sim_type, ignore_files=None):
def __init__(self, sim_type, ignore_files=None, update_filenames=False):
import sirepo.template

self.__adapter = sirepo.template.import_module(sim_type).LibAdapter(
ignore_files or []
ignore_files or [],
update_filenames,
)

def parse_file(self, path):
Expand Down
5 changes: 5 additions & 0 deletions sirepo/package_data/static/css/omega.css
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,9 @@
.table-hover > tbody > tr:hover {
background-color: var(--sr-item-bg-dark-mode);
}

.sr-login-panel, .help-block {
color: var(--sr-panel-text-dark-mode);
}

}
33 changes: 32 additions & 1 deletion sirepo/package_data/static/js/elegant.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,37 @@ SIREPO.app.controller('VisualizationController', function(appState, elegantServi
return columns[1];
}

const defaultColumns = {
twiss_output: {
"y1": "betax",
"y2": "betay",
"y3": "etax",
},
"run_setup.sigma": {
"y1": "Sx",
"y2": "Sy",
"y3": "Ss",
},
"run_setup.centroid": {
"y1": "Cx",
"y2": "Cy",
},
};

function setDefaultColumns(model, plottableColumns) {
model.x = plottableColumns[0];
for (const f in defaultColumns) {
if (model.xFile.includes(f)) {
for (const y in defaultColumns[f]) {
if (plottableColumns.includes(defaultColumns[f][y])) {
model[y] = defaultColumns[f][y];
}
}
model.includeLattice = "1";
}
}
}

self.simHandleStatus = function (data) {
self.simulationAlerts = data.alert || '';
if (data.frameCount) {
Expand Down Expand Up @@ -562,9 +593,9 @@ SIREPO.app.controller('VisualizationController', function(appState, elegantServi
m = appState.models[modelKey] = {
xFile: info.filename,
y1File: info.filename,
x: info.plottableColumns[0],
xFileId: info.id,
};
setDefaultColumns(m, info.plottableColumns);
// Only display the first outputFile
if (i > 0 && ! panelState.isHidden(modelKey)) {
panelState.toggleHidden(modelKey);
Expand Down
19 changes: 4 additions & 15 deletions sirepo/package_data/static/js/omega.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ SIREPO.app.directive('beamAndPhasePlots', function(appState, omegaService) {
};

$scope.$on('modelChanged', (e, name) => {
if (! $scope.reports) {
return;
}
for (const sim of $scope.reports) {
if (name === sim[1][0].modelKey) {
const updated = [];
Expand All @@ -183,7 +186,7 @@ SIREPO.app.directive('beamAndPhasePlots', function(appState, omegaService) {
};
});

SIREPO.app.directive('dynamicSimList', function(appState, requestSender) {
SIREPO.app.directive('dynamicSimList', function(appState) {
return {
restrict: 'A',
scope: {
Expand All @@ -196,20 +199,6 @@ SIREPO.app.directive('dynamicSimList', function(appState, requestSender) {
</div>
`,
controller: function($scope) {
const requestSimListByType = (simType) => {
requestSender.sendRequest(
'listSimulations',
() => {},
{
simulationType: simType,
}
);
};
if (SIREPO.APP_SCHEMA.relatedSimTypes) {
SIREPO.APP_SCHEMA.relatedSimTypes.forEach(simType => {
requestSimListByType(simType);
});
}
$scope.selectedCode = () => {
if ($scope.model) {
$scope.code = $scope.model.simulationType;
Expand Down
46 changes: 33 additions & 13 deletions sirepo/package_data/static/js/sirepo-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -3465,6 +3465,7 @@ SIREPO.app.directive('completeRegistration', function() {
return {
restrict: 'A',
template: `
<div class="sr-login-panel">
<form class="form-horizontal" autocomplete="off" novalidate>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-10">
Expand All @@ -3484,6 +3485,7 @@ SIREPO.app.directive('completeRegistration', function() {
</div>
</div>
</form>
</div>
`,
};
});
Expand All @@ -3493,6 +3495,7 @@ SIREPO.app.directive('emailLogin', function(requestSender, errorService) {
restrict: 'A',
scope: {},
template: `
<div class="sr-login-panel">
<div data-ng-show="isJupyterHub" class="alert alert-info col-sm-offset-2 col-sm-10" role="alert">
We're improving your Jupyter experience by making both Jupyter and Sirepo accessible via a single email login. Simply follow the directions below to complete this process.
</div>
Expand Down Expand Up @@ -3521,6 +3524,7 @@ SIREPO.app.directive('emailLogin', function(requestSender, errorService) {
<div data-confirmation-modal="" data-is-required="true" data-id="sr-email-login-done" data-title="Check your inbox" data-ok-text="" data-cancel-text="">
<p>We just emailed a confirmation link to {{ data.sentEmail }}. Click the link and you'll be signed in. You may close this window.</p>
</div>
</div>
`,
controller: function($scope) {
function handleResponse(data) {
Expand Down Expand Up @@ -3570,6 +3574,7 @@ SIREPO.app.directive('emailLoginConfirm', function() {
return {
restrict: 'A',
template: `
<div class="sr-login-panel">
<div class="row text-center">
<p>Please click the button below to complete the login process.</p>
</div>
Expand All @@ -3579,6 +3584,7 @@ SIREPO.app.directive('emailLoginConfirm', function() {
<button data-ng-click="loginConfirm.submit()" class="btn btn-primary">Confirm</button>
</div>
</form>
</div>
`,
};
});
Expand Down Expand Up @@ -5246,23 +5252,38 @@ SIREPO.app.directive('simList', function(appState, requestSender) {
route: '@',
},
template: `
<span data-loading-spinner data-sentinel="simList">
<span data-loading-spinner data-sentinel="items">
<div style="white-space: nowrap">
<select style="display: inline-block" class="form-control" data-ng-model="model[field]" data-ng-options="item.simulationId as itemName(item) disable when item.invalidMsg for item in simList"></select>
<select style="display: inline-block" class="form-control" data-ng-model="model[field]" data-ng-options="item.simulationId as item.name disable when item.isInvalid for item in items"></select>

<button type="button" style="padding: 3px 10px 5px 10px; margin-top: -1px" title="View Simulation" class="btn btn-default" data-ng-click="openSimulation()"><span class="glyphicon glyphicon-eye-open"></span></button>
</div>
</span>
`,
controller: function($scope) {
$scope.simList = null;

// special processing of the item's name if necessary
$scope.itemName = function(item) {
return item.invalidMsg ? `${item.name} <${item.invalidMsg}>` : item.name;
};
function buildList(simList) {
$scope.items = [];
for (const s of simList) {
$scope.items.push({
simulationId: s.simulationId,
isInvalid: s.invalidMsg ? true : false,
name: itemName(s),
});
}
$scope.items.sort((a, b) => a.name.localeCompare(b.name));
}

function itemName(sim) {
const n = sim.folder === '/'
? `/${sim.name}`
: `${sim.folder}/${sim.name}`;
return sim.invalidMsg
? `${n} <${sim.invalidMsg}>`
: n;
}

$scope.openSimulation = function() {
$scope.openSimulation = () => {
if ($scope.model && $scope.model[$scope.field]) {
requestSender.openSimulation(
$scope.code,
Expand All @@ -5271,14 +5292,13 @@ SIREPO.app.directive('simList', function(appState, requestSender) {
);
}
};
appState.whenModelsLoaded($scope, function() {

appState.whenModelsLoaded($scope, () => {
requestSender.sendStatefulCompute(
appState,
function(data) {
(data) => {
if (appState.isLoaded() && data.simList) {
$scope.simList = data.simList.sort(function(a, b) {
return a.name.localeCompare(b.name);
});
buildList(data.simList);
}
},
{
Expand Down
Loading
Loading