Comments (4)
Hello Jonathan,
some things you can do, some will require work.
If you edit workflow.config, the new config will take effect immediately. You can already use # to comment rules. You can enable them at runtime by un-commenting them. The only thing you cannot do is have it "forget" that a rule was processed and have it processed again. Yet what you can do is "touch" all the files and the rule will run again.
One thing you cannot do at runtime is call workflow.py -c . That is because workflow.cache is a shelve object and gets corrupted is accessed concurrently.
Is this sufficient? Give it a try.
Massimo
On May 31, 2012, at 8:10 PM, Jonathan Paugh wrote:
Great stuff! This is a handy little script!
I'd like to see a way to add/clear rules from a running instance of workflow. For example, I often want to recompile a source file I'm working on whenever I save it to disk. If I set up workflow to monitor my home directory, then use judicious globs, I could use a rule like this:recompile: proj/tex/test-proj/*.tex: pdftex $0
But, I'd like to be able to add this to a running instance of workflow, rather than editing the config file and restarting workflow every time I want to add a new rule. Especially since I don't want it to always use this rule: just while I'm working on test-proj.
I think this could be done in 3 steps:
- watch the cache file for changes, and reload the
data
dict if it changes.- add a
--new
option that adds a new rule, like so:./workflow.py --new "recompile: proj/tex/test-proj/*.tex: pdftex \$0"
This would mirror the behavior of--clear
- add an option to change the currently running workflow, rather than starting a new one.
This would cause either--new
or--clear
to update the cache, but immediately shut down, rather than the norm.I'm going to look into this and see how doable it is. (I might have a patch in a few days.) In particular, I wonder if shelve is thread-safe like that. If not, an alternate solution would be to contact the current daemon and let it update the cache itself.
Reply to this email directly or view it on GitHub:
#4
from workflow.
Alright, that sounds okay. If I can figure out how, I'd still like to do it from the command line, though. If I make any progress, I'll let ya know. (I haven't worked on a LaTeX project for a while--but next time, I'll have workflow. :-)
from workflow.
I implemented your suggestion:
start the daemon
$ python workflow.py -d
clear a run at runtime
$ python workflow.py -c myrule
this creates the file .workflow.myrule.clear, the daemon reads it, clears workflow.cache and deleted the tmp file.
I like your idea because you can have a rule that "forgets" another rule by creating the tmp file.
Please check it.
Massimo
On May 31, 2012, at 8:27 PM, Jonathan Paugh wrote:
Update: I see that shelve can't stand having multiple writers to a single cache. A workaround would be to generate temporary config file(s) in the folder specified by
--f
with names like.add-workflow.PID
orclear-workflow.PID
where PID is the process id of the adding/clearing process. Idk. I guess it's a bit of a hack however it's done.
Reply to this email directly or view it on GitHub:
#4 (comment)
from workflow.
I tested this out, and I like it a lot. I used that as a starting point to add an --add
option. (Check my pull request).
from workflow.
Related Issues (4)
- "BSD license" HOT 1
- __getitem__(name) KeyError HOT 5
- watch for file modifications HOT 1
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 workflow.