-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #743 from SteVwonder/job-shell-staging-plugin
Add job shell staging plugin
- Loading branch information
Showing
36 changed files
with
28,334 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/*****************************************************************************\ | ||
* LLNL-CODE-658032 All rights reserved. | ||
* | ||
* This file is part of the Flux resource manager framework. | ||
* For details, see https://github.com/flux-framework. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation; either version 2 of the license, or (at your option) | ||
* any later version. | ||
* | ||
* Flux is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the terms and conditions of the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
* See also: http://www.gnu.org/licenses/ | ||
\*****************************************************************************/ | ||
|
||
#include "resource/schema/ephemeral.hpp" | ||
|
||
namespace Flux { | ||
namespace resource_model { | ||
|
||
int ephemeral_t::insert (uint64_t epoch, | ||
const std::string &key, | ||
const std::string &value) | ||
{ | ||
int rc = 0; | ||
|
||
try { | ||
check_and_clear_if_stale (epoch); | ||
m_epoch = epoch; | ||
auto ret = m_store.insert(std::make_pair (key, value)); | ||
if (!ret.second) { | ||
errno = EEXIST; | ||
rc = -1; | ||
} | ||
} catch (std::bad_alloc &) { | ||
errno = ENOMEM; | ||
rc = -1; | ||
} | ||
|
||
return rc; | ||
} | ||
|
||
boost::optional<std::string> ephemeral_t::get (uint64_t epoch, const std::string &key) | ||
{ | ||
if (check_and_clear_if_stale (epoch)) { | ||
return boost::none; | ||
} | ||
|
||
try { | ||
auto it = m_store.find (key); | ||
if (it == m_store.end ()) { | ||
return boost::none; | ||
} | ||
|
||
auto value = (*it).second; | ||
return value; | ||
} catch (const std::out_of_range& oor) { | ||
return boost::none; | ||
} | ||
} | ||
|
||
|
||
|
||
const std::map<std::string, std::string>& ephemeral_t::to_map (uint64_t epoch) | ||
{ | ||
check_and_clear_if_stale (epoch); | ||
return this->to_map (); | ||
} | ||
|
||
const std::map<std::string, std::string>& ephemeral_t::to_map () const | ||
{ | ||
return m_store; | ||
} | ||
|
||
bool ephemeral_t::check_and_clear_if_stale (uint64_t epoch) | ||
{ | ||
if (m_epoch < epoch) { | ||
// data is stale | ||
this->clear (); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
|
||
void ephemeral_t::clear () | ||
{ | ||
m_store.clear (); | ||
} | ||
|
||
|
||
} // resource_model | ||
} // Flux | ||
|
||
/* | ||
* vi:tabstop=4 shiftwidth=4 expandtab | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*****************************************************************************\ | ||
* LLNL-CODE-658032 All rights reserved. | ||
* | ||
* This file is part of the Flux resource manager framework. | ||
* For details, see https://github.com/flux-framework. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation; either version 2 of the license, or (at your option) | ||
* any later version. | ||
* | ||
* Flux is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the terms and conditions of the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
* See also: http://www.gnu.org/licenses/ | ||
\*****************************************************************************/ | ||
|
||
#ifndef EPHEMERAL_H | ||
#define EPHEMERAL_H | ||
|
||
#include <cstdint> | ||
#include <map> | ||
#include <boost/optional.hpp> | ||
|
||
namespace Flux { | ||
namespace resource_model { | ||
|
||
class ephemeral_t { | ||
public: | ||
int insert (uint64_t epoch, | ||
const std::string &key, | ||
const std::string &value); | ||
boost::optional<std::string> get (uint64_t epoch, const std::string &key); | ||
const std::map<std::string, std::string>& to_map (uint64_t epoch); | ||
const std::map<std::string, std::string>& to_map () const; | ||
bool check_and_clear_if_stale (uint64_t epoch); | ||
void clear (); | ||
|
||
private: | ||
std::map<std::string, std::string> m_store; | ||
uint64_t m_epoch; | ||
}; | ||
|
||
} // resource_model | ||
} // Flux | ||
|
||
#endif // EPHEMERAL_H | ||
|
||
/* | ||
* vi:tabstop=4 shiftwidth=4 expandtab | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.NOTPARALLEL: | ||
|
||
SUBDIRS = common cmd | ||
SUBDIRS = common cmd shell | ||
|
||
check-local: all |
Oops, something went wrong.