const char Container::AOC_ENTRY[]="attached_on_cloning";
+const char Container::STORE_CONTEXT_PROPERTY[]="store_context";
+
Container::Container():_isAttachedOnCloning(false),_proc(0)
{
}
setProperty((*it).first,(*it).second);
}
+bool Container::storeContext()
+{
+ bool found = false;
+ std::string str_value;
+ str_value = getProperty(STORE_CONTEXT_PROPERTY);
+ const char* yes_values[] = {"YES", "Yes", "yes", "TRUE", "True", "true", "1",
+ "ON", "on", "On"};
+ for(const char* v : yes_values)
+ if(str_value == v)
+ {
+ found = true;
+ break;
+ }
+ return found;
+}
+
+void Container::setStoreContext(bool v)
+{
+ if(v)
+ setProperty(STORE_CONTEXT_PROPERTY, "1");
+ else
+ setProperty(STORE_CONTEXT_PROPERTY, "0");
+}
+
const std::string& resource_name,
const std::string& container_name);
virtual bool canAcceptImposedResource();
+ virtual bool storeContext();
+ virtual void setStoreContext(bool v);
virtual std::string getPlacementId(const Task *askingNode) const = 0;
virtual std::string getFullPlacementId(const Task *askingNode) const = 0;
//Edition only methods
virtual void shutdown(int level) = 0;
static const char KIND_ENTRY[];
static const char AOC_ENTRY[];
+ static const char STORE_CONTEXT_PROPERTY[];
protected:
std::string _name;
mutable bool _isAttachedOnCloning;
FormContainer::FillPanel(0); // --- set widgets before signal connexion to avoid false modif detection
connect(cb_type, SIGNAL(activated(const QString&)),this, SLOT(onModifyType(const QString&)));
connect(ch_aoc,SIGNAL(stateChanged(int)),this,SLOT(onModifyAOC(int)));
+ connect(ch_pycache,SIGNAL(stateChanged(int)),this,SLOT(onModifyStorePyCache(int)));
}
FormContainer::~FormContainer()
DEBTRACE("FormContainer::FillPanel");
FormContainerBase::FillPanel(container);
if(container)
+ {
ch_aoc->setCheckState(container->isAttachedOnCloning()?Qt::Checked:Qt::Unchecked);
+ ch_pycache->setCheckState(container->storeContext()?Qt::Checked:Qt::Unchecked);
+ }
cb_type->clear();
cb_type->addItem("mono");
cb_type->addItem("multi");
if(prop!=val2)
onModified();
}
+
+void FormContainer::onModifyStorePyCache(int val)
+{
+ if (!_container)
+ return;
+ bool val2(false);
+ if(val==Qt::Unchecked)
+ val2=false;
+ if(val==Qt::Checked)
+ val2=true;
+ bool prop = _container->storeContext();
+ int prop2((int)val2);
+ std::ostringstream oss; oss << prop2;
+ //_properties[YACS::ENGINE::Container::AOC_ENTRY]=oss.str();
+ _container->setStoreContext(val2);
+ if(prop!=val2)
+ onModified();
+}
public slots:
void onModifyType(const QString &text);
void onModifyAOC(int val);
+ void onModifyStorePyCache(int val);
private:
QComboBox *cb_type;
};
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="ch_pycache">
+ <property name="text">
+ <string>Store python cache</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
" args=pickle.loads(st)\n"
" return args\n";
-const char PythonNode::KEEP_CONTEXT_PROPERTY[]="keep_context";
-
PythonEntry::PythonEntry():_context(0),_pyfuncSer(0),_pyfuncUnser(0),_pyfuncSimpleSer(0)
{
}
squeezeMemoryRemote();
}
//
- if(!keepContext())
+ if(!storeContext())
{
if(!CORBA::is_nil(_pynode))
{
std::string PythonNode::pythonEntryName()const
{
- if(keepContext())
+ if(storeContext())
return "DEFAULT_NAME_FOR_UNIQUE_PYTHON_NODE_ENTRY";
else
return getName();
}
-bool PythonNode::keepContext()const
+bool PythonNode::storeContext()const
{
bool found = false;
if(_container)
- {
- std::string str_value = _container->getProperty(KEEP_CONTEXT_PROPERTY);
- const char* yes_values[] = {"YES", "Yes", "yes", "TRUE", "True", "true", "1",
- "ON", "on", "On"};
- for(const char* v : yes_values)
- if(str_value == v)
- {
- found = true;
- break;
- }
- }
+ found = _container->storeContext();
return found;
}
void imposeResource(const std::string& resource_name,
const std::string& container_name) override;
bool canAcceptImposedResource()override;
- bool keepContext()const;
+ bool storeContext()const;
std::string getContainerLog();
PythonNode* cloneNode(const std::string& name);
virtual std::string typeName() { return "YACS__ENGINE__PythonNode"; }
static const char SCRIPT_FOR_SERIALIZATION[];
static const char REMOTE_NAME[];
static const char DPL_INFO_NAME[];
- static const char KEEP_CONTEXT_PROPERTY[];
protected:
bool _autoSqueeze = false;
Engines::PyScriptNode_var _pynode;